Sheet 06 Query
JSONPath tester
Run standard RFC 9535 JSONPath against your own JSON. Matches are highlighted in the document and listed with their normalized paths.
{
"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": 399
}
}
}
[ "Sayings of the Century", "Moby Dick" ]
2 nodes matched.
How to use it
Type a query, or pick one from Examples to run it against the RFC's bookstore document. The result updates as you type: Document highlights each match, Values lists what matched, and Paths gives each node's normalized path and JSON Pointer.
Syntax at a glance
| Syntax | Selects |
|---|---|
$ / @ | The root / the current node inside a filter |
.name ['a b'] | An object member; quote names with spaces or dots |
[0] [-1] | An array element, negative from the end |
[1:5:2] | A slice: start, end, step |
* .. | Every child / at any depth |
[a, b] | Several selectors, duplicates kept |
[?@.price < 10] | A filter: comparisons, && || !, or just [?@.isbn] to test existence |
length() count() | Size of a value / number of nodes |
match() search() value() | Whole or partial I-Regexp match / a single node's value |
RFC 9535 versus older JSONPath
The RFC (2024) standardised the syntax Stefan Goessner sketched in 2007, and many older libraries differ from it. Script expressions such as [(@.length-1)] and operators such as =~ or in are gone; regular expressions go through match() and search(). Comparisons never convert types, so 1 == '1' is false. Filter parentheses are optional, and every query starts with $. This tester runs in standard-only mode, so a query that works here works in any compliant implementation.
Questions
What is a normalized path?
The single canonical path RFC 9535 gives each node, with quoted names and plain indexes, like $['store']['book'][0]. The Paths view also shows it as a JSON Pointer, ready for a JSON Patch.
Which library runs the queries?
json-p3 (MIT licence), which is tested against the JSONPath Compliance Test Suite, in its strict mode with no extensions. It is loaded from this site and runs in your browser.
Is my document uploaded?
No. Queries run in this tab and nothing you paste leaves it. Page views are counted with Cloudflare Web Analytics, which sets no cookies and never sees your data.