toolqik

123 · JSON

JSONPath Tester

Run JSONPath queries (RFC 9535) against your JSON and see the matches and paths.

Runs in your browser
Show
Path style
Matches

  

About this tool

JSONPath is a query language for JSON, in the same way XPath is for XML. An expression like $.store.book[*].author selects values from a document without writing loops. This tester runs your expression against your JSON as you type and shows every match, its path, and a clear message when the expression has a syntax error. It follows RFC 9535, the 2024 IETF standard for JSONPath.

JSONPath syntax

SyntaxMeaningExample
$The root of the document$
.name or ['name']A child property$.store.bicycle
*All children$.store.*
..Recursive descent: matches at any depth$..price
[n], [-1]Array item by position; negative counts from the end$.store.book[-1]
[a,b]Several items or names$.store.book[0,2]
[start:end:step]Array slice (end excluded)$.store.book[:2]
[?expr]Filter: keep items where the expression is true$..book[?@.price < 10]
@The current item inside a filter[?@.isbn] (has an isbn)

Filters support ==, !=, <, <=, >, >=, &&, ||, ! and parentheses, plus the standard functions length(), count(), match() (whole-string regex), search() (regex anywhere) and value().

Differences between JSONPath implementations

Before RFC 9535, every library had its own dialect, and they still differ. Older libraries (such as Jayway in Java and jsonpath-plus in JavaScript) write filters as [?(@.price < 10)] with parentheses; RFC 9535 makes the parentheses optional, and this tester accepts both. Script expressions like [(@.length-1)] are not part of the standard; use [-1] instead. If an expression works here but not in your library, check that library’s documentation for its filter syntax.

Use JSONPath in code

// npm install jsonpath-plus
import { JSONPath } from 'jsonpath-plus';

const titles = JSONPath({ path: '$.store.book[?(@.price < 10)].title', json: data });

Not sure of the path? Click a value in the JSON viewer to copy its path.

FAQ

What is JSONPath?

A query language for selecting values from JSON, similar to XPath for XML. For example, $.store.book[*].author returns the author of every book. It was standardized as RFC 9535 in 2024.

How do I filter an array in JSONPath?

Use a filter selector with @ for the current item: $.store.book[?@.price < 10] returns books cheaper than 10. Combine conditions with && and ||, for example [?@.category == "fiction" && @.price > 10].

What does .. mean in JSONPath?

Recursive descent: it searches at every depth. $..price returns every price property anywhere in the document.

How do I get the last item of an array?

Use a negative index: $.items[-1]. A slice also works: $.items[-1:].

Why does my expression work in another tool but not here?

JSONPath libraries differ. This tester follows RFC 9535. Non-standard features such as script expressions [(…)] or the parent operator ^ are not supported.

Is JSONPath the same as jq?

No. jq is a full programming language for transforming JSON on the command line. JSONPath only selects values, but it is built into many tools and libraries such as Kubernetes kubectl, PostgreSQL (SQL/JSON path) and API testing tools.

esc
↑↓ navigate↵ open