#dict to json file import json with open('result.json', 'w') as fp: json.dump(sample, fp) #json file to dict import json with open("data.json", "r") as json_file: my_dict = json.load(json_file)