I want to convert some 20mb+ JSON files to CSV.

Tried using webapps like https://konklone.io/json/ or https://www.convertcsv.com/json-to-csv.htm but they just crash.

So how can I use other tools to do such conversions?

  • Not really an answer but the Macs come with Python so you could create a program to do it! – Andyroo Jul 2 at 12:42

jq works quite well for this, you can install it via Homebrew. Specific usage depends on the structure of your JSON file, the accepted answer on https://unix.stackexchange.com/questions/570548/convert-json-array-into-csv has details which should help to get started.

| improve this answer | |

Other than some poor experiences you've had with the web-based converters, you've not indicated what your preferences are for programming language; e.g. Python, JavaScript, shell, etc. There are many options available, and it's really a matter of finding one that's in your "comfort zone".

Search engines are great for identifying options for something like this. For example, if you want to do this in Python, this search may help. A more language-neutral search may be to search github for JSON to CSV converters.

I tend to do these things from the command line, or in small scripts. I've tried jq and I've tried Miller (akamlr). jq has a larger following, but I have a preference for Miller because I get results I need without too much effort... but YMMV. One other thing: If you decide to try Miller you should file this link to the "Cookbook" page for Miller... it's not advertised well, but I find it useful 'cause I'm a cook :)

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .