Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

python json to csv

import pandas as pd

df = pd.read_json (r'my_file.json')
# content of my_file.json :
#
# {"Product":{"0":"Desktop Computer","1":"Tablet","2":"Printer","3":"Laptop"},"Price":{"0":700,"1":250,"2":100,"3":1200}}

df.to_csv (r'my_file.csv', index = None)
# content of my_file.json :
#
# Product,Price
# Desktop Computer,700
# Tablet,250
# Printer,100
# Laptop,1200
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #json #csv
ADD COMMENT
Topic
Name
4+5 =