pretty_print_json = pprint.pformat(json_data).replace("'", '"') with open('file_name.json', 'w') as f: f.write(pretty_print_json)