JSON (Python)
Load JSON from file
def load_json(fp):
with open(fp, 'r') as f:
output = json.load(f)
return output
Save to JSON file
def save_json(fp):
with open(fp, 'w') as f:
# with pretty output kwargs
json.dump(sample, f, indent=4, sort_keys=True)
References:
Last modified: 202401040446