JSONPath Tester – Query JSON with JSONPath
Paste JSON, type a JSONPath expression and see the matching values and their paths instantly. This JSONPath tester supports wildcards, recursive descent, array slices and filters like ?(@.price < 10).
Press Ctrl+Enter (⌘+Enter on Mac) to run now.
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
Linecolumn
Query JSON with JSONPath Expressions
JSONPath is to JSON what XPath is to XML: a short expression such as $..author that selects values deep inside a document. It is used in API testing tools, Kubernetes kubectl -o jsonpath, AWS Step Functions, log processors and many SDKs. This JSONPath tester shows the result of an expression the moment you type it, so you can build and debug a query against your real data before you paste it into a test or a config file.
Every match is listed with its normalized path, such as $['store']['book'][2], and its JSON Pointer, which tells you exactly where it came from. Expressions are evaluated in your browser with the open-source jsonpath-plus library in its safe evaluation mode, which never runs your filters as arbitrary JavaScript.
How to test a JSONPath expression
- Paste your JSON into the input, open a
.jsonfile, or keep the classic bookstore sample. - Type an expression starting with
$, or click one of the examples above the editor. - Read the result as a JSON array of matched values, normalized paths or JSON Pointers, in the Text, Tree or Table view.
- Check the matches table to see where each value lives in the document.
- Copy or download the result as
jsonpath-result.json.
A valid expression that matches nothing returns an empty array [], not an error. Invalid JSON and invalid expressions get separate error messages; for help with the JSON itself, use the JSON validator.
JSONPath syntax reference
| Syntax | Meaning | Example |
|---|---|---|
$ | The root of the document | $ |
@ | The current item inside a filter | [?(@.price < 10)] |
.name ['name'] | Child by name (use brackets for names with spaces or dots) | $.store['bicycle'] |
* | Wildcard: all children of an object or array | $.store.* |
.. | Recursive descent: search at every depth | $..price |
[n] | Array index, negative counts from the end | $..book[0] |
[start:end:step] | Array slice, end not included | $..book[0:2] |
[a,b] | Several indexes or names | $..book[0,1] |
[?(…)] | Filter: keep items where the expression is true | $..book[?(@.isbn)] |
~ | jsonpath-plus: return property names instead of values | $.store.*~ |
^ | jsonpath-plus: return the parent of the match | $..book[0]^ |
Examples on the bookstore JSON
| Expression | Result |
|---|---|
$..author | All four authors, from Nigel Rees to J. R. R. Tolkien |
$.store.book[?(@.price < 10)].title | “Sayings of the Century” and “Moby Dick” |
$.store.book[0:2].title | The first two titles (index 0 and 1) |
$..book[-1:].title | “The Lord of the Rings”, the last book |
$..book[?(@.isbn)].title | The two books that have an isbn |
$..price | Five prices: 8.95, 12.99, 8.99, 22.99 and 19.95 |
$.store.* | Two results: the book array and the bicycle object |
$.store.*~ | The property names "book" and "bicycle" |
JSONPath dialects and filters
JSONPath was described by Stefan Gössner in 2007 and was only standardized in 2024 as RFC 9535, so implementations differ in details. This tester uses jsonpath-plus, which follows the original syntax: filters are written [?(@.price < 10)] with parentheses, both == and === work, and &&, || and ! combine conditions. It also adds extensions such as ~ for property names and ^ for the parent. RFC 9535 writes filters without the parentheses and offers functions such as length() and match() instead of JavaScript expressions, so check which dialect your target tool speaks.
Filters are evaluated with the library’s safe mode, a small interpreter that supports comparisons and property access but cannot call arbitrary code, so a pasted expression cannot run scripts in your page.
Tips
- Start broad, then narrow:
$..bookfirst, then add[*], a filter and finally the field. - Missing fields are simply skipped by filters like
[?(@.isbn)], which makes them a quick way to find incomplete records. - Use the normalized path from the table when you need one exact value in a test assertion.
- Large or minified JSON? Tidy it first with the JSON Formatter, or export the matches to a spreadsheet with JSON to CSV.
- Browser recordings: a HAR file is JSON too. Try
$.log.entries[?(@.response.status >= 400)].request.url, or open it in the HAR Viewer.
Frequently Asked Questions
Common questions about JSONPath.
JSONPath is a query language for JSON. An expression such as $.store.book[0].title selects one or more values from a document, similar to XPath for XML. It was standardized by the IETF as RFC 9535 in 2024.
.. is recursive descent: it searches the whole document at every depth. $..price returns every price field, wherever it appears.
Use a filter expression with @ for the current item, for example $.store.book[?(@.price < 10)]. Combine conditions with && and ||.
[start:end:step] works like Python slices: the end index is not included and negative numbers count from the end. [0:2] returns the first two items and [-1:] the last one.
A normalized path such as $['store']['book'][0] is JSONPath notation. A JSON Pointer (RFC 6901) such as /store/book/0 points to the same place and is used by JSON Patch and JSON Schema.
The expression is valid but nothing in the document matches. Check the spelling and case of field names, and whether the data is wrapped in an extra object or array.
No. jq is a separate command-line language that can also transform data. JSONPath only selects values, which is why it is used in many configuration files and testing tools.
No. Parsing and evaluation run in your browser. Only the jsonpath-plus library (version 10.4.0) is loaded from the unpkg CDN.