# Directly from dictionary with open('json_data.json', 'w') as outfile: json.dump(json_string, outfile) # Using a JSON string with open('json_data.json', 'w') as outfile: outfile.write(json_string)