Answers for "read write json file python"

66

python read json file

import json

with open('path_to_file/person.json') as f:
  data = json.load(f)

print(data)
Posted by: Guest on April-08-2020
0

dump json in file python

with open('data.txt', 'w') as f:
    json.dump(jsonData, f)
Posted by: Guest on June-15-2021
0

write json to file python

# to write on file
# data_dict is a dictionary

import json
        
with open('data.json', 'w') as f:
	json.dump(data_dict, f)
Posted by: Guest on January-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language