Skip to main content

2.2. Root Identifier

2.2. Root Identifier

2.2.1. Syntax

Every JSONPath query (except those inside filter expressions; see Section 2.3.5) MUST begin with the root identifier $.

root-identifier     = "$"

2.2.2. Semantics

The root identifier $ represents the root node of the query argument and produces a nodelist consisting of that root node.

2.2.3. Examples

Note: In this example and the following examples in Sections
2.2 and 2.3, except for Table 11, we will present a JSON text
to show the JSON value used as the query argument to the
queries in the examples and then a table with the following
columns:

* Query: an example query to be applied to the query
argument

* Result: the query result as a list of JSON values that
were located in the query argument

* Result Path: the query result as a list of (normalized)
paths into the query argument, giving locations of the
JSON values in the previous column

* Comment: descriptive information

JSON:

{"k": "v"}

Queries:

QueryResultResult PathComment
${"k": "v"}$Root node

Table 3: Root Identifier Example