vinay20045 / json-to-csv

Nested JSON to CSV Converter
https://askvinay.com/post/converting-nested-json-to-csv-8-december-2013.html
MIT License
286 stars 219 forks source link
csv csv-converter json json-to-csv python

json-to-csv

Nested JSON to CSV Converter.

This python script converts valid, preformatted JSON to CSV which can be opened in excel and other similar applications. This script can handle nested json with multiple objects and arrays. Please see the explanation below and the sample files to understand how this works. It can handle non similar objects too. But, more the similarity of the objects, prettier the output.

Written in Python 2.7. Last tested in Python 3.6.3.

Usage

python /path/to/json_to_csv.py node json_in_file_path csv_out_file_path

Source Specification

The script expects the json to be given via a file containing

Gotchas

I have written a JSON generator which will take care of encoding issues and generate a valid JSON for this tool. However, If you find yourself in the character encoding hell, drop me a mail and I will add support for this This is now fixed.

Read More

Visit converting nested json to csv post on my blog to read more about this script.