I need to convert a CSV file (attached) into JSON which is proving to be more complicated than it should be and I am sure that there is a simple solution. Some lower-level elements of the JSON have more that one element that would be labelled with a (#1) extension if the operation would be reversed.
I don’t have a problem where there is a single sub-element but as soon as there are 2 or more things go pear-shaped.

The JSON structure I need to create looks like this:


Composed from csv data that looks like this:

Data Sample CSV

Any help would be appreciated.



1 Like

Hey @TigerCole,

Here’s a basic example to demonstrate a way to solve this challenge:

table_to_json.knwf (11.2 KB)

In the example above, columns are not broken out with the “(#1)” convention that you showed in your sample data. Instead, the fields are unique and there can be duplicates in the uuid column (see below). I’m guessing that this is closer to what your source data looks like.


Assuming that’s similar to the shape of the source data, you can use the Columns to JSON node to concatenate values such as name and value into JSON blobs and then use the GroupBy node to create a set (array) of blobs per uuid.


Finally, you’d use the Table to JSON node with the “Keep rows” aggregation direction to generate one JSON blob for each uuid.

The output will look something like this:




This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.