JSON Path

This Node Is Deprecated — This version of the node has been replaced with a new and improved version. The old version is kept for backwards-compatibility, but for all new workflows we suggest to use the version linked below.
Go to Suggested ReplacementJSON Path

JSONPath is a similar to XPath alternative for JSON.

The result can be a single value or a list of multiple values.

There are two notations, dot-notation:$.book[1].title and bracket-notation: $['book'][1]['title'] (indexing starts from 0, negative indices are relative to the last element).

Example input: {"book": [ {"year": 1999, "title": "Timeline", "author": "Michael Crichton"}, {"year": 2000, "title": "Plain Truth", "author": "Jodi Picoult"} ]}

Example results: $.book[0] - {"year": 1999, "title": "Timeline", "author": "Michael Crichton"} (JSON or String single value)
$.book[*].year - [1999,2000] (JSON or Int or Real list)
$.book[2].year - ? (no such part)
$..author - Timeline (String) or "Timeline" (JSON)

The default path ($..*) will select all possible subparts (excluding the whole JSON value).

When you request the paths instead of values for the $.book[0].* JSONPath, you will get the paths -in bracket notation- as a list of Strings:

  • $['book'][0]['year']
  • $['book'][0]['title']
  • $['book'][0]['author']
which are valid JSONPaths for the input JSON value.

The filters ?(expr)can be used to select contents with specific properties, for example $..book[?(@.publisher)] selects the books that specify their publisher (@ refers to the actual element).

It uses the jayway/JsonPath implementation.

Options

Settings

JSON column
The JSON column to select the paths from.
Remove source column
When checked, the source column will be removed.
New column
Name of the new column (its type is of result type, or a list of it).
JSONPath
The JSONPath to select.
Return the paths instead of values
When checked, the paths matching the JSONPath in the input JSON value will be returned (as a list of Strings) for each row, not the values referenced by the JSONPath (for example see above, like $.['book'][0]).
Result type
The expected result type. (If something is found at that path and cannot convert to the expected type missing value is returned. If not found, missing value will be returned.)
Result is list
When checked the result column will have a collection type.

Input Ports

Icon
A table with JSON column

Output Ports

Icon
Table with the found parts

Views

This node has no views

Workflows

  • No workflows found

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.