JSONPath
   HOME

TheInfoList



OR:

In computer software, JSONPath is a
query language A query language, also known as data query language or database query language (DQL), is a computer language used to make queries in databases and information systems. In database systems, query languages rely on strict theory to retrieve informa ...
for querying values in
JSON JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
. 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 expression In query languages, path expressions identify an object by describing how to navigate to it in some graph (possibly implicit) of objects. For example, the path expression ''p''.Manager.Home.City might refer the city of residence of someone's manage ...
s written as strings, e.g. $.foo.


Example

The JSONPath expression $.store.book /code> applied to the following JSON value: selects the first book (by Nigel Rees): The expression $.store.book price extracts the prices of books: 8.95 and 22.99 (since /code> selects all the nodes of an array). The expression $..price 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 Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
ecosystem. In 2024, the
IETF The Internet Engineering Task Force (IETF) is a standards organization for the Internet standard, Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster ...
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

* JMESPath is a query language for JSON with features that go far beyond JSONPath. It has a specification, a compliance test suite, and multiple implementations in various languages. * JSONata An open source query and transformation language for JSON data inspired by XPath 3.1. * JSON Pointer defines a string syntax for identifying a single value within a given JSON value of known structure. *
JSONiq JSONiq is a query and functional programming language that is designed to declaratively query and transform collections of hierarchical and heterogeneous data in format of JSON, XML, as well as unstructured, textual data. JSONiq is an open spec ...
is a query and transformation language for JSON. *
XPath XPath (XML Path Language) is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) in 1999, and can be used to compute values (e.g., strings, numbers, or ...
3.1 is an expression language that allows the processing of values conforming to the XDM data model. The version 3.1 of XPath supports JSON as well as XML. * is like for JSON data – it can be used to slice and filter and map and transform structured data.


References


External links

* {{Query languages JSON Query languages