dump a dict to json python code example Example: write dict to json python import json with open('result.json', 'w') as fp: json.dump(sample, fp)