Mar 19 2019
Tablecruncher for Mac provides an export function to easily achieve this task. A CSV file can be either stored as an array of arrays, where each line is represented as an array. Or it is stored as an array of objects, where each line is an object with the header names as the key and the cells from the line being the values. But let’s look at an example to better understand the difference.
We’re using a simple file to show how easy it is to convert a CSV file to JSON. Please look at the header row, where there are header names “Name”, “Value” and “Category”.
With the command “File > Export JSON …” you’re storing this CSV file as an array of objects because the header rows have been activated. (The JSON file shown below has been reformatted to highlight the structure of the data. Tablecruncher creates files that are not pretty-printed.)
If your CSV file has no header row or the headers should be treated as normal data, you’re deactivating the header row. Now our demo file looks like this:
When we now export that CSV file to JSON, we’ll get a JSON file that’s an array of arrays. (Again I’ve reformatted the JSON to show the structure.)
With Tablecruncher it’s just a single click to convert your CSV files to JSON in one of two possible data structures. If you’ve questions regarding this tutorial or if you have ideas for further tutorials, don’t hesitate to contact me by e-mail: email@example.com