Skip to content

JSON Path Node

The JSONPath node allows accessing and manipulating data in JSON structures using the JSONPath query language. JSONPath is similar to XPath but is specifically designed for working with JSON data.


Inputs

obj: Accepts a JSON object on which the JSONPath query will be performed.

query: Accepts a string representing the JSONPath query to be executed on the JSON object.


Outputs

obj: Outputs the result of the JSONPath query, which can be a value, an object, or an array, depending on the query and the structure of the JSON object.


Properties

query: Allows setting a default JSONPath query that will be used if no query is provided in the “query” input.


Functioning

1. The node receives a JSON object through the “obj” input.

2. If a JSONPath query is provided through the “query” input, that query will be used. Otherwise, the query set in the node’s “query” property will be used. If no query is provided, an empty query will be used.

3. The node executes the JSONPath query on the JSON object using the JSONPath library.

4. The result of the query is emitted through the “obj” output. The result can be a value, an object, or an array, depending on the query and the structure of the JSON object.


Usage

1. Connect a JSON object to the “obj” input of the node.

2. Optionally, connect a JSONPath query to the “query” input of the node or set a default query in the node’s “query” property.

3. The node will execute the JSONPath query on the JSON object and output the result through the “obj” output.

4. You can use the result of the query to perform further operations or manipulations in the data flow.


Examples of JSONPath Queries

  • $: Selects the entire JSON object.
  • $.name: Selects the value of the “name” property in the JSON object.
  • $.books[*].title: Selects the titles of all books in the “books” array.
  • $..author: Selects all the values of the “author” property at any level of the JSON object.