Hub
  • Software
  • Blog
  • Forum
  • Events
  • Documentation
  • About KNIME
  • KNIME Hub
  • Nodes
  • JSON Path
NodeNode / Manipulator

JSON Path

Structured Data JSON Streamable
Drag & drop
Like
Copy short link

JSONPath is a query language for JSON, similar to XPath for XML.

The result of a simple query (also called definite JSONPath) is a single value. The result of a collection query (also called indefinite JSONPath) is a list of multiple values. Results of JSONPath queries are converted to the selected KNIME type. If the result is a list and the selected KNIME type is not compatible, the execution will fail. If the result cannot be converted to the selected KNIME type, a missing value will be returned.

JSONPath queries can be automatically generated via the node configuration dialog. To create a simple query, select a single value from the JSON-Cell Preview window and click "Add single query". To create a collection query, select a value that is part of a list of values from the JSON-Cell Preview window and click "Add collection query". Alternatively, you can write your own JSONPath query by clicking the "Add JSONPath" button.

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

Example JSONPath queries and evaluation results:
$.book[0]
{"year": 1999, "title": "Timeline", "author": "Michael Crichton"} ( JSON or String single value)
$.book[*].year
[1999,2000] ( JSON , Int or Real list)
$.book[2].year
? (no such part)
$.book[?(@.year==1999)].title
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).

The JSON Path node uses the Jayway JSONPath implementation.

Node details

Input ports
  1. Type: Table
    Table with JSON
    A table with JSON column
Output ports
  1. Type: Table
    Table
    Table with the found parts

Extension

The JSON Path node is part of this extension:

  1. Go to item

Related workflows & nodes

  1. Go to item
    Accessing GitHub API
    stelfrich > Public > Accessing GitHub API
  2. Go to item
    Forum_Question_Access_JSON_Table_Via_Get_Request
    kathrin > Public > Forum_Questions > Forum_Question_Access_JSON_Table_Via_Get_Request
  3. Go to item
    COVID-19 SARS-CoV-2 preprints from medRxiv and bioRxiv
    MedRxiv BioRxiv
    https://connect.medrxiv.org/relate/collection_json.php?grp=181 The URL linked above outpu…
    tymsk3891 > Public > medRxiv > COVID-19 SARS-CoV-2 preprints from medRxiv and bioRxiv
  4. Go to item
    Call a remote workflow as RESTful web service
    Demonstration of how to pass parameters and execute a workflow on the KNIME Server via a …
    knime > Examples > 06_Control_Structures > 07_Workflow_Orchestration > 02_Call_Workflow_and_REST > 02_call_server_workflow_(REST)
  5. Go to item
    create_job_and_execute
    ana_ved > Public > create_job_and_execute
  6. Go to item
    JSON simple example to extract data via Path
    Json Path Xml
    +1
    JSON simple example to extract data via Path
    mlauber71 > Public > kn_example_json_simple
  7. Go to item
    Call a remote workflow as RESTful web service
    Demonstration of how to pass parameters and execute a workflow on the KNIME Server via a …
    elmtalab > Public > 02_call_server_workflow_(REST)
  8. Go to item
    dcif_news_Übung
    kathrin > dcif_webinar > dcif_news_Übung
  9. Go to item
    Extract Info from JSON
    kathrin > Forum Questions > Extract Info from JSON
  10. Go to item
    KNIME_energy
    philipdjup > Public > Assignment1 > KNIME_energy
  1. Go to item
  2. Go to item
  3. Go to item
  4. Go to item
  5. Go to item
  6. Go to item

KNIME
Open for Innovation

KNIME AG
Hardturmstrasse 66
8005 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • E-Learning course
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • KNIME Open Source Story
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more on KNIME Server
© 2022 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Credits