CSV to JSON Examples

JSONify It is a CSV to JSON converter designed to help you easily convert tabular data from spreadsheets, CSV files or any delimited file into JSON. What makes JSONify It stand out from other CSV to JSON converters available online is its ability to generate nested JSON. This is particularly useful for those looking to create multilevel visualizations such as zoomable/drilldown treemaps and Foamtrees, both of which require a specifically nested format of JSON to function.

Sample Data

The sample data used in these examples was generated using the very useful random CSV generator at ExtendsClass.

Example 1. Simple Conversion

Let's start off with the simplest case. Converting your delimited data without changing any of the output options will give you a structure that has a "Base Structure" set to "records". This is an array of objects, with each object representing a row. This output is shown below.

Example 2. Alternate Structures

Maybe the "records" structure is not what you are looking for. In this case, the simplest way to significantly modify the output JSON is to change the "Base Structure" (under "Step 3. Output Options"). There are several options, and one is likely to fit what you want, or at least get close. The output shown below is for "list".

Example 3. Having an Index Column

Next to the Base Structure option, you will notice an option for choosing a column to set as the Index. What this means is highly dependent on the Base Structure. For some structures (records, list) the index column will just be ignored. For others is will change the keys to the values in the index column or change the way the columns are divided up. Below is the output for "Dict" with the ID column set as the index column.

Example 4. Nesting

So this is probably what you have come here for – how do you add nesting? The nesting works using the values in one or more columns that you specify using the "Add Level" button under "Nesting Options". The converter will then group the rows based on the values in those columns, in the order they are specified (i.e. a new level of nesting for each column specified). The example below is nesting by country and profession, using the "records" Base Structure. Note: you can recorder the nested columns you have selected by clicking and dragging them.

Example 5. Nesting with Additional Options

In addition to adding levels of nesting, you also have some convenience options.

Renaming Fields

By default, the grouped rows will be provided with a key "children". If you want a different key, you can specify it by entering a value in the "Children Key" field. The group will also get a "name" key which specifies the value that is being grouped by. This can also be changed.

Summary Statistics

If you have numerical values, you can add summary statistics for each group. This is fairly limited at the moment: only one column and only a sum and an average.

The output below has been structured in the same way as Example 4, but with changed keys ("name" -> "groupedBy", "children" -> "records") and summary statistics added (for the ID column in both cases).

Why is not working?

There are certain combinations of structures and nesting that will simply not work when combined. When it doesn't work, you will get a very generic error message (sorry about that). In those cases, you will have to try a different combination.