import json # the json file where the output must be stored out_file = open("myfile.json", "w") json.dump(data, out_file) out_file.close()