Python Lire le fichier JSON
import json
with open('path_to_file/person.json') as f:
data = json.load(f)
print(data)
MzanziLegend
import json
with open('path_to_file/person.json') as f:
data = json.load(f)
print(data)
import json
with open('path_to_file/person.json') as f:
data = json.load(f)
import json
uglyjson = '{"firstnam":"James","surname":"Bond","mobile":["007-700-007","001-007-007-0007"]}'
#json.load method converts JSON string to Python Object
parsed = json.loads(uglyjson)
print(json.dumps(parsed, indent=2, sort_keys=True))
import json
data = {"key": "value"}
with open('data.json', 'w') as jsonfile:
json.dump(data, jsonfile)
import json
with open('data.json', 'w') as f:
json.dump(data, f)
import json
with open('Json file') as read:
read_json = json.load(read)