Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

python convert json to csv

import json
import csv
 
with open('G:Akhiljsonoutput.json') as json_file:
    jsondata = json.load(json_file)
 
data_file = open('G:Akhiljsonoutput.csv', 'w', newline='')
csv_writer = csv.writer(data_file)
 
count = 0
for data in jsondata:
    if count == 0:
        header = data.keys()
        csv_writer.writerow(header)
        count += 1
    csv_writer.writerow(data.values())
 
data_file.close()
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #convert #json #csv
ADD COMMENT
Topic
Name
8+8 =