0 ×

JSON Path

StreamableDeprecatedJSON related functionality for KNIME version 4.3.0.v202011191521 by KNIME AG, Zurich, Switzerland

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

Best Friends (Incoming)

Installation

To use this node in KNIME, install KNIME JSON-Processing from the following update site:

KNIME 4.3

A zipped version of the software site can be downloaded here.

You don't know what to do with this link? Read our NodePit Product and Node Installation Guide that explains you in detail how to install nodes to your KNIME Analytics Platform.

Wait a sec! You want to explore and install nodes even faster? We highly recommend our NodePit for KNIME extension for your KNIME Analytics Platform. Browse NodePit from within KNIME, install nodes with just one click and share your workflows with NodePit Space.

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.