JSON Path Query Tool
Test a JSONPath expression on your JSON and see the match count, each matching value and its path. Filters such as ?(@.price < 10) work. Up to 100 KB. How it works
Use the JSON Path Query Tool
Run a query to see results here
About the JSON Path Query Tool
On the sample bookstore document, $..book[?(@.price < 10)] returns 1 match, The Great Gatsby at 8.99, with the path $['store']['book'][3]. Paste a JSON document of up to 100 KB and type a JSONPath expression: as you type, the tool shows the match count, the matches as JSON and the path of each match. Execute, or Ctrl or Cmd plus Enter, runs it on demand.
JSONPath expressions on the sample document
| Expression | Selects | Matches | Path of the first match |
|---|---|---|---|
| $.store.book[*].title | Every book title | 4 | $['store']['book'][0]['title'] |
| $..author | Every author, at any depth | 4 | $['store']['book'][0]['author'] |
| $..book[?(@.price < 10)] | Books priced under 10 | 1 | $['store']['book'][3] |
| $..book[?(@.genre == 'Fiction')].title | Titles of the books whose genre is Fiction | 2 | $['store']['book'][0]['title'] |
| $.store.bicycle | The bicycle object | 1 | $['store']['bicycle'] |
| $..price | Every price, at any depth | 5 | $['store']['book'][0]['price'] |
| $..* | Every node below the root | 30 | $['store'] |
| $.store.book[0] | The first book | 1 | $['store']['book'][0] |
| $.store.book[-1:] | The last book | 1 | $['store']['book'][3] |
| $.store.book[0,1].title | Titles of the first two books | 2 | $['store']['book'][0]['title'] |
| $.store.book.length | The number of books (a feature of the library) | 1 | $['store']['book']['length'] |
| $.nothing | A name that is not in the document | 0 | none |
Run on the sample document behind Load Sample, with the library the tool uses. The result of $.store.book.length is the number 4.
How to use this tool
- Paste a JSON document, open or drop a .json file, or press Load Sample. Up to 100 KB (102,400 bytes) is checked and queried.
- Type a JSONPath expression that starts with $, or press one of the quick queries such as All book titles.
- Results follow your edits once the JSON parses and the expression is complete, at once for a small document and after a 0.4-second pause for one over 20,000 characters. The query runs in a Web Worker. Execute, or Ctrl or Cmd plus Enter, runs it on demand; a document and expression from a link or your saved values wait for that or for an edit.
- Read the match count, the matches as JSON and the list of paths. While the document or expression is being changed, the old results are hidden until the new ones arrive.
Frequently asked questions
- How do I test a JSONPath expression online?
- Paste the JSON and type the expression; the matches appear as you type. Each match is shown as JSON with its normalized path, such as $['store']['book'][3], so you can copy a path into code or a config. Load Sample fills in a bookstore document to try the queries on.
- What does $..book[?(@.price < 10)] mean?
- $ is the root, .. searches at any depth, book picks members called book, and [?(...)] keeps the items for which the test is true, with @ standing for the item being tested. On the sample it returns 1 match: The Great Gatsby, priced 8.99.
- Is JSONPath a standard?
- Yes. RFC 9535, published in 2024 as a Proposed Standard, defines it; its history section says it is based on Stefan Gössner’s proposal dated 2007-02-21. This tool uses the jsonpath-plus library and does not claim to follow RFC 9535 in every detail.
- Why do I get 0 matches?
- The expression is valid but selects nothing, as with $.nothing, which shows 0 matches and an empty list. Names are matched exactly, so check the spelling and the capital letters in your document, start from $, and use $..name to search at any depth.
- How large a document can I query?
- Up to 100 KB, which is 102,400 bytes of UTF-8. Above that the page does not parse the document and nothing runs. A query that has not answered after 10 seconds is stopped. A document that is only null, 0, false or an empty string cannot be queried; put it inside an object or array.
- Is my JSON saved or sent anywhere?
- Your document and expression are saved in this browser until you press Clear Saved Values. The query runs in a Web Worker on the page and the tool makes no network request. A document or expression that comes from a link (the json and query parameters) is shown but not written to your saved values.
Related Tools
View all toolsJSON Formatter
Paste JSON to format it with 2 spaces, 4 spaces or tabs, minify it or sort its keys. A syntax error is reported with its line, column and a caret under it.
Base64 Converter
Encode text to Base64 or decode Base64 to text. UTF-8, standard and URL-safe alphabets, optional padding on decode, up to 250,000 characters.
URL Encoder/Decoder
Percent-encode or decode text as you type: one value with encodeURIComponent or a whole URL with encodeURI, and an option to read + as a space.
UUID Generator
Generate 1 to 1,000 random v4 UUIDs, or time-based v1, or name-based v5 and v3 from a namespace and a name, and copy them. Repeats of v4 are very unlikely.
ULID Generator
Generate 1 to 500 ULIDs, 26-character IDs that sort by creation time, in upper or lower case, and decode any ULID to the date it was made.
HTML Entity Encoder
Encode text to HTML entities (& < > " ') or decode any of the 2,231 named references in the HTML standard and numeric ones such as é.