Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

json to csv in python

'''
@author : alixaprodev.com
'''
import csv, json
input_json_file='json_file.json'
output_csv_file='csv_file.csv'
input = open(input_json_file)
data = json.load(input)
input.close()
output = csv.writer(open(output_csv_file,'w'))
output.writerow(data[0].keys())  # header row
for row in data:
    output.writerow(row.values())
Source by www.alixaprodev.com #
 
PREVIOUS NEXT
Tagged: #json #csv #python
ADD COMMENT
Topic
Name
1+1 =