I have a JSON file I want to convert to a CSV file. How can I do this with Python?
I tried:
import json import c
Try this
import csv, json, sys input = open(sys.argv[1]) data = json.load(input) input.close() output = csv.writer(sys.stdout) output.writerow(data[0].keys()) # header row for item in data: output.writerow(item.values())