Columns to JSON

The columns values are transformed to JSON objects for each row. When there are conflicting keys, the result is undefined, might vary between different versions of KNIME.


An example transformation:
From table:

MainNumtext
main12Hello
main21World

with custom key/values: const and val, Main as data bound key, Num with manual num key and text as automatic:

{"main1":{"text": "Hello", "num": 2, "const":"val"}}
{"main2":{"text": "World", "num": 1, "const":"val"}}

Options

New column name
Name of the new JSON column
Remove source columns
The source columns include the Data bound key column too (when that is selected)
Root key type
How to create the root of the JSON value
  • Unamed root elements: Generate JSON without a wrapping key.
  • Custom key: Use a constant key for all rows.
  • Data bound key: Use a column value from each row as the key.
Custom key name
Specify the constant key to use for the root object.
Data bound key column
Select the column whose values will be used as the root keys.
Manual column selection
The predefined key and the actual value in the selected columns will provide the keys and values in the object
  • Key: The key name.
  • Value: The key value.
Automatic column selection
The keys are the column names and the actual value in the selected columns will provide the keys and values in the object
Custom key/value pairs
Additional key/value pairs within the object
  • Key: The key name.
  • Value: The key value.

Input Ports

Icon
Table with values.

Output Ports

Icon
Table with the row-wise generated JSON column.

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.