DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How to Select and Filter Nested JSON with JSONPath

Use JSONPath to select nested values and filter JSON arrays. Learn the roles of $, @, wildcards, slices, descendant paths, and RFC 9535 result behavior.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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:

$.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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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
The SQL Programming Language: .
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$..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.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • 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

Bestseller No. 1
Bestseller No. 2
The SQL Programming Language: .
The SQL Programming Language: .
Used Book in Good Condition
$4.23

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.