Developer and Text Tools

JSONPath Explained: Query JSON with RFC 9535 Expressions

Learn JSONPath syntax step by step: root, child, wildcard, recursive descent, slices and filters, with RFC 9535 functions and a free in-browser tester.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
JSONPath Explained: Query JSON with RFC 9535 Expressions

JSONPath Explained: Query JSON with RFC 9535 Expressions

JSONPath is to JSON what XPath is to XML: a short expression that picks values out of a document. It is used in API testing tools, Kubernetes kubectl -o jsonpath, log pipelines, monitoring alerts and many low-code platforms. For years every library interpreted it slightly differently, until RFC 9535 standardised the syntax in 2024. The free JSONPath Query Tester follows that standard, shows every match with its normalized path and explains why an expression returns nothing.

The building blocks

Every query starts at the root, written $. From there you step into the document:

  • $.store.name selects a member by name. Use brackets for names with spaces or symbols: $['first name'].
  • $.items[0] selects the first array element; $.items[-1] selects the last.
  • $.items[*] selects every element (or every member of an object).
  • $..price is recursive descent: every price member at any depth.
  • $.items[1:4] is a slice from index 1 up to, but not including, 4. A step works too: [::2] picks every second element.

You can combine these freely. $..book[*].author reads as "every author of every book, wherever books appear".

Filters

Filters are where JSONPath becomes powerful. A filter is written [?condition], and inside it @ stands for the current item:

RFC 9535 also defines functions. length(@.tags) > 2 checks sizes, match(@.code, '[A-Z]{3}') tests a whole string against a regular expression, search(@.title, 'guide') looks for a pattern anywhere in the string, and count(@.*) counts children.

Normalized paths

Each result in the tester comes with its normalized path, such as $['store']['book'][2]['price']. This is the canonical, unambiguous address of the value. It is useful when you need to tell a colleague exactly which value you mean, or when you want to turn a match into a JSON Pointer for a patch.

Why a query returns nothing

The most common causes are easy to check:

  1. Case: member names are case sensitive, so $.User does not match user.
  2. Arrays versus objects: $.items.name fails when items is an array; you need $.items[*].name.
  3. Quotes: strings inside filters need single or double quotes; bare words are not strings.
  4. Library dialects: older libraries accepted $..book[?(@.price<10)] with parentheses. RFC 9535 accepts that form too, but some engines use their own extensions, such as script expressions, which the standard does not include.

The tester reports syntax errors with the position of the problem, so you can fix the expression rather than guess.

A worked example

Take the classic bookstore document with four books and a bicycle. $..book[[email protected] < 10].title returns two titles. $..price returns five prices, including the bicycle's. $.store.book[-1].author returns the author of the last book. Try each in the tester and watch the matches highlight.

JSONPath versus JSON Pointer

JSON Pointer (RFC 6901), written like /store/book/0/title, addresses exactly one value and has no wildcards or filters. It is what JSON Patch uses. JSONPath is a query language that can return many values. Use a pointer when you need one precise location, and JSONPath when you need to search.

Step by step

  1. Paste your JSON or load a file.
  2. Type an expression starting with $.
  3. Read the matching values and their normalized paths.
  4. Adjust the filter until the result is exactly the set you need.
  5. Copy the result as a JSON array for use in tests or scripts.

Privacy

Queries run in your browser, so you can explore real API responses and production logs without sending them anywhere.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages