1import json
2
3data = {"key": "value"}
4
5with open('data.json', 'w') as jsonfile:
6 json.dump(data, jsonfile)
7
1import json
2
3with open('data.txt') as json_file:
4 data = json.load(json_file)
1import json
2
3with open('file_to_load.json', 'r') as file:
4 data = json.load(file)