JSON2CSV – convert json files to csv

JSON2CSV is a python script that converts json data to a csv file.

json2csv

json2csv.py_.txt

Download above text file “json2csv.py_.txt” then rename “json2csv.py”

>> python json2csv.py “input.json” “output.csv”

JSON – input.json

[
{
“createdAt”: “2014-02-20T18:15:56.818Z”,
“fbID”: “34534534534”,
“lessonQuestions”: 5,
“lessonScore”: 2750,
“lesson_no”: 2,
“objectId”: “htmsuPr6F6”,
“updatedAt”: “2014-02-22T15:42:38.166Z”
},
{
“createdAt”: “2014-02-21T16:45:52.550Z”,
“fbID”: “100001132788807”,
“lessonQuestions”: 5,
“lessonScore”: 1100,
“lesson_no”: 3,
“objectId”: “xgmJxEyBHl”,
“updatedAt”: “2014-02-22T18:14:38.107Z”
}
]

CSV – output.csv

createdAt, fbID, lessonQuestions, lessonScore, lesson_no, objectId, updatedAt
2014-02-20T18:15:56.818Z, 34534534534, 5, 2750, 2, htmsuPr6F6, 2014-02-22T15:42:38.166Z
2014-02-21T16:45:52.550Z, 100001132788807, 5, 1100, 3, xgmJxEyBHl, 2014-02-22T18:14:38.107Z

Ref: https://github.com/vladikk/json2csv