JSONPath Tester
Test JSONPath expressions against JSON data in real time. View matched results with syntax highlighting. Supports filters, wildcards, and recursive descent. Free, browser-based.
- Runs in your browser
- Your data never leaves your browser
- Free · No Sign-Up
Scan with WeChat to share this tool
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.
JSONPath Syntax Reference (RFC 9535)
$— root of the document.key,['key'],["key"]— member of an object[n],[-1]— array element; negative indexes count from the end[start:end:step]— slice, for example[0:2],[1:],[::-1][0,2],['title','price']— several selectors in one bracket; results follow the order of the selectors[*],.*— all array elements or object member values..key,..[0],..*— descendants at any depth[?@.price < 10]— filter; also written[?(@.price < 10)][?@.isbn],[?!@.isbn]— members that exist / do not exist[?@.a.b == 'x' && @.c > $.min]— nested paths,&&||!, and absolute $ paths inside a filterlength(),count(),match(),search(),value()— the five functions defined by RFC 9535
Limitations
- Syntax outside RFC 9535 is rejected with “Unsupported syntax” and the character position: script expressions
[(...)],=~,in/nin, and extensions such as~for member names from other libraries. $.store.book.lengthselects a member namedlength, which arrays do not have, so the result is empty. Uselength()inside a filter, for example$[?length(@.book) > 3].- Results list the matched values. Normalized paths (such as
$['store']['book'][0]) are not shown. - Object members are returned in the order they appear in your JSON. RFC 9535 leaves this order open, so other implementations can return them in a different order.
match()andsearch()run the pattern as a JavaScript regular expression with theuflag after changing.to[^\n\r](RFC 9485 §5.3). Patterns that JavaScript rejects give false; JavaScript-only syntax such as\dor lookahead is accepted.- Numbers are JavaScript numbers after
JSON.parse, so integers above 253 lose precision before they are compared.
Examples on the Sample Data
The page opens with a small bookstore document: four books and a bicycle. These are the tool’s results for it:
| Expression | Result |
|---|---|
$.store.book[?@.price < 10].title | ["Sayings of the Century", "Moby Dick"] (2 matches) |
$.store.book[-1].author | "J. R. R. Tolkien" (1 match) |
$..price | [8.95, 12.99, 8.99, 22.99, 19.95]: the four book prices, then the bicycle |
$.store.book[?@.isbn].title | No matches found: no book in the sample has an isbn member |
$.store.book[(@.length-1)] | Unsupported syntax: script expressions such as [(@.length-1)] are not part of RFC 9535; use a negative index such as [-1] (at character 14) |
When exactly one value matches, the Results panel shows that value on its own; with two or more, it shows a JSON array. Copy takes the panel as shown, so a single string is copied with its quotes. Results are pretty-printed with two-space indentation.
Other JSONPath Dialects
Many tools say “JSONPath” but implement a different language. An expression that works here may need changes elsewhere, and the reverse:
- kubectl uses JSONPath templates: the expression goes inside braces, the leading
$is optional, and there are extra keywords such asrangeandend, as inkubectl get pods -o jsonpath='{.items[*].metadata.name}'. Paste only the part inside the braces here, with$added in front. - Jayway JsonPath (Java) and libraries based on Stefan Goessner’s 2007 article accept script expressions, the
=~regex operator and functions such as.length()at the end of a path. This tool follows RFC 9535 and rejects them with the position of the problem. - AWS Step Functions accepts JsonPath in fields such as
InputPath, but a reference path such asResultPathmust point to a single node and cannot use filters, wildcards or slices, which this tool accepts.
To reshape JSON rather than only select from it, use the jq Playground; to check the document first, use the JSON Formatter.
FAQ
What is JSONPath?
JSONPath is a query language for JSON, analogous to XPath for XML. It uses a path expression to select nodes from a JSON document. RFC 9535 (2024) standardizes it. Variants of it appear in kubectl output templates, AWS Step Functions and many API testing tools.
What does $ mean in a JSONPath expression?
$ refers to the root element of the JSON document. Every valid JSONPath expression must start with $. On its own, $ selects the entire document. You chain selectors after it, such as $.store.book[0].title.
How do I select all items in an array?
Use the wildcard selector [*] after the array's key. For example, $.store.book[*] returns all book objects in the array. You can further drill into each item: $.store.book[*].author returns every author value.
How do filter expressions work?
A filter is written [?expression], and @ is the element being tested. Under RFC 9535 the parentheses are optional, so $.store.book[?@.price < 10] and $.store.book[?(@.price < 10)] are the same. You can use ==, !=, <, <=, >, >=, combine conditions with &&, || and !, test nested paths such as @.author.name, compare with other parts of the document through $, and call length(), count(), match(), search() and value().
What is recursive descent (..) ?
The .. operator recursively searches all descendants of the current node. For example, $..author finds every author field anywhere in the JSON tree, regardless of nesting depth.
Why do I see "Unsupported syntax"?
The expression uses syntax that RFC 9535 does not define, so the tool stops and shows the character position instead of returning an empty result. Common cases are script expressions such as [(@.length-1)] (use [-1]), the =~ operator (use match() or search()), and in / nin. An empty result with "No matches found" means the expression is valid but nothing in the JSON matches it.