JSONPath


In computer software, JSONPath is a query language for querying values in JSON. The uses of JSONPath include:
  • Selecting a specific node in a JSON value
  • Retrieving a set of nodes from a JSON value, based on specific criteria
  • Navigating through complex JSON values to retrieve the required data.
JSONPath queries are path expressions written as strings, e.g. $.foo.

Example

The JSONPath expression applied to the following JSON value:


selects the first book :


The expression extracts the prices of books: 8.95 and 22.99.
The expression extracts all the prices: 8.95, 22.99, and 399.

History

JSONPath was first described in an online article by Stefan Gössner in February 2007. Gössner also published initial implementations in JavaScript and PHP.
Subsequently, over fifty implementations were created in various programming languages. The JSONPath Comparison Project lists many of these implementations and compares their behavior. JSONPath is widely used in the Java ecosystem.
In 2024, the IETF published a standard for JSONPath as.

Research

Scalable Processing of Contemporary Semi-Structured Data on Commodity Parallel Processors - A Compilation-based Approach describes an optimisation which converts JSONPath queries into parallel programs with bounded memory requirements.Supporting Descendants in SIMD-Accelerated JSONPath describes an optimisation of JSONPath descendant queries when streaming potentially very large JSON values.τJSONPath: A Temporal Extension of the JSONPath Language for the τJSchema Framework describes a temporal extension of JSONPath that supports querying the versions of a JSON value over its version history.

Alternatives