JSONPath lets you select values from nested JSON with expressions that start at $, the root. Use child selectors to follow a known structure, wildcards or slices to select array elements, and filters to keep only items that meet a condition. The current IETF standard is RFC 9535, published in February 2024; check whether your particular tool supports its required syntax and how its API represents results.
What JSONPath queries do
A JSONPath expression describes which nodes to select from a JSON value. It does not prescribe how a library must perform the query internally. RFC 9535 defines the required query results and syntax; a tool may return selected values, paths identifying those values, or both.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
The C Programming Language | $17.46 | Buy on Amazon |
| 2 |
|
The SQL Programming Language: . | $4.23 | Buy on Amazon |
As an Amazon Associate I earn from qualifying purchases.
The examples below use a bookstore-shaped JSON document, with a store object containing a book array. Each expression is a path through that structure, not a command that changes the JSON.
Start at the root and follow child properties
Every JSONPath query begins with $, which denotes the JSON value being queried. To reach the title of the first book, write:
#1 Best Overall
$.store.book[0].title
This follows the store property, then the book array, selects index 0, and reads that item’s title. Array indexes are zero-based, so index 0 is the first element.
Dot notation is a convenient shorthand for common property names. The equivalent bracket form is:
$['store']['book'][0]['title']
RFC 9535 treats bracket notation as canonical and defines the shorthand in terms of it. Brackets with quoted names are useful when a property name needs quoting rather than ordinary dot notation.
Select multiple values with wildcards and slices
Wildcard: select every child at a level
The wildcard * matches children at the position where it appears. To select the title from each book:
$.store.book[*].title
The wildcard expands across the array’s book elements; the following .title selects each matching title.
Slice: select a range of array elements
A slice selects a range of array positions. For example:
$.store.book[0:3].title
This selects titles for elements at indexes 0, 1, and 2. The end index, 3, is excluded. If the array has fewer elements than the requested range, only existing elements can match.
Recommended Free Tools
Filter an array by a condition
A filter expression, written with ?(), tests candidate nodes and selects those for which its logical expression matches. To select titles of books priced below 10:
Rank #2
- Used Book in Good Condition
$.store.book[[email protected] < 10].title
Inside the filter, @ refers to the current candidate book. Thus @.price reads that book’s price, and the comparison keeps candidates whose price is less than 10. The outer $ continues to refer to the root JSON value.
RFC 9535 defines comparisons, logical operators, existence tests, and function extensions for filters. A particular implementation may have additional functions; treat those as implementation-specific unless they are part of the standardized function set.
Search below the current node with a descendant segment
Use two dots to select matching names at descendant levels rather than following one fixed child path. For example:
Free tools Windows power users keep installed
One-click scans. No signup required.
$..author
This selects author values found below the root, wherever an author member occurs in the JSON structure. Descendant traversal is useful when the nesting path is not fixed, but it can match values in more than one branch.
Understand what a query returns
In RFC 9535, the abstract result is a nodelist: zero or more selected nodes. How that result appears in code depends on the implementation’s API.
- No match is valid. An empty nodelist does not by itself mean the query is invalid.
- An out-of-range index selects nothing. A missing array position does not make the query fail under the standard’s result model.
- Duplicates can remain. If a query selects the same node more than once, the result may contain it that many times; selection does not automatically deduplicate.
- Object-member order is unspecified. JSON arrays have ordered children, but JSON objects are unordered, so the standard does not stipulate the order of selected object members. Do not rely on an order for results drawn from object members.
Check compatibility in the JSONPath tool you use
RFC 9535 standardizes syntax and required query results, but leaves internal implementation choices open. A tool’s interface may expose values, normalized paths, or both, and its support for required syntax should be checked rather than assumed. Function extensions also require care: distinguish standardized functions from additions provided by a particular implementation.
When comparing libraries or tools, check these concrete points in their current documentation or conformance evidence:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute- Whether they support the RFC 9535 selectors and filter syntax used in your queries.
- Which standardized filter functions they implement, and whether they add implementation-specific functions.
- Whether the API returns values, paths, or both.
- How they present duplicate selections, empty results, and result ordering.
The RFC Editor maintains an errata report for RFC 9535; consult it when checking the standard’s current corrections.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




