Convert large json file into csv using python
1 min readAug 2, 2019
simple,
- get a json file for testing,
example file : https://github.com/zeMirco/sf-city-lots-json
2. install the module pandas if not installed
pip install pandas
3. run the following python script
python json-to-csv.py
json-to-csv.py file contains
import jsonimport pandas as pdfrom pandas.io.json import json_normalizef = open('citylots.json') # open the json filedata = json.load(f) # load as jsonf.close()df = json_normalize(data['features']) #load json into dataframedf.to_csv('json-to-csv.csv', sep=',', encoding='utf-8') #save as csv