import csv import json # Open the JSON file with open('data.json') as json_file: data = json.load(json_file) # Create a new CSV file and write the data with open('data.csv', 'w', newline='') as csv_file: writer = csv.DictWriter(csv_file, fieldnames=data[0].keys()) writer.writeheader() for row in data: writer.writerow(row)