Arquivo JSON de leitura python
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
data = {"key": "value"}
with open('data.json', 'w') as jsonfile:
json.dump(data, jsonfile)
import json
with open('data.txt') as json_file:
data = json.load(json_file)
import json
with open('file_to_load.json', 'r') as file:
data = json.load(file)
import json
data = {}
with open('data.txt', 'w') as outfile:
json.dump(data, outfile)
import json
#reading
with open(file_name, 'r') as f:
data = json.load(f)
#writing
with open(file_name, 'w') as f:
json.dump(data, f) #use indent to make easyer to read eg. indent = 4