Skip to main content
CalcChef

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

Enter a JSON document to begin
Enter a JSONPath expression
Results

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

ExpressionSelectsMatchesPath of the first match
$.store.book[*].titleEvery book title4$['store']['book'][0]['title']
$..authorEvery author, at any depth4$['store']['book'][0]['author']
$..book[?(@.price < 10)]Books priced under 101$['store']['book'][3]
$..book[?(@.genre == 'Fiction')].titleTitles of the books whose genre is Fiction2$['store']['book'][0]['title']
$.store.bicycleThe bicycle object1$['store']['bicycle']
$..priceEvery price, at any depth5$['store']['book'][0]['price']
$..*Every node below the root30$['store']
$.store.book[0]The first book1$['store']['book'][0]
$.store.book[-1:]The last book1$['store']['book'][3]
$.store.book[0,1].titleTitles of the first two books2$['store']['book'][0]['title']
$.store.book.lengthThe number of books (a feature of the library)1$['store']['book']['length']
$.nothingA name that is not in the document0none

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

  1. 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.
  2. Type a JSONPath expression that starts with $, or press one of the quick queries such as All book titles.
  3. 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.
  4. 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 tools