I want to export data from KNIME into a JSON format as follows:
[ -15.42, 95 ],
[ -15.36, 95 ],
and I have a data a normal table:
I tried several combinations of the “Transpose”- and “Table to JSON”-node and the best outcome is a transposed version and the “column oriented” “aggration column” (see attached workflow json1.knwf (10.4 KB)):
"Row0" : [ 1.0, 33.3 ],
"Row1" : [ 2000.0, 111.1 ],
"Row2" : [ 500.0, 55.5 ]
that still needs changes like removing the rowid, adding brackets and “values”,
Is there a easy way to change it or do I have to use editng of the JSON?
As you probably tried already, I’ve been trying to find a straight forward node configuration but I couldn’t. For this specific request I think that you will have to customize your JSON file.
I’ve prepared a simple example workflow as a custom solution, it’s based in your shared workflow:
i do not understand how you calculate the values ’ -15.42’ in the first row, but here is a solution how to create the JSON fast and easy.
Hope that helps,
Thanks very much for that trick.
i just noticed that you can cut the column rename, since you can change the column name to ‘values’ directly inside the column aggregator node (options → aggregation settings → Column name).
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.