JSON Transformer

Applies a patch or a merge patch on the input JSON column.

When a (merge) patch cannot be applied, missing values will be generated, node execution will not fail.

See also the node: JSON Diff.

Given {"a":"b","c":{"d":"e","f": "g"} } let us assume the target is {"a":"z","c":{"d":"e"} } (changing a's value to z and removing f). To achieve this, either the following patch should be applied: [{"op":"replace","path":"/a","value":"z"},{"op":"remove","path":"/c/f"}] or this merge and patch: {"a":"z","c":{"f": null} }

The following operators (op) are supported for patch:

  • add (path, value)
  • remove (path)
  • replace (path, value)
  • move (from, path)
  • copy (from, path)
  • test (path, value)

The merge and patch format reconstructs the parts that need to be changed (changes included), all else can be omitted.

It uses the fge/json-patch implementation.

To refer to flow variables, use the $${TflowVarName}$$ syntax (where T is S for String type, D for floating point numbers and I for integer numbers).

To refer to columns (boolean, numeric, String, JSON), use the $columnName$ syntax.

References to (0-based) row index ($$ROWINDEX$$), row count ($$ROWCOUNT$$) and row keys ($$ROWID$$) can also be used in values.

Options

JSON column
The column containing JSON values
Remove source column
When checked, the source column will be removed
New column
Name of the new (JSON) column
Patch type
Either patch or a merge and patch
Keep original value when 'test' operation fails
When there are failing 'test' operations, the original value is kept instead of inserting a missing value (and a warning is issued).
Patch
A JSON of the selected patch type compatible with the JSON values. The patch expression must either be a single JSON Patch expression (object) or an array of JSON Patch expressions.

Input Ports

Icon
A table with JSON column to transform

Output Ports

Icon
Table with the transformed JSON values

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.