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)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter