write dictionary in json file code example
Example 1: write dict to json python
import json
with open('result.json', 'w') as fp:
json.dump(sample, fp)
Example 2: create dict from json file python
import json
with open("data.json", "r") as json_file:
my_dict = json.load(json_file)