JSONPath Tester

Test JSONPath expressions.

2 results

About the JSONPath Tester

Evaluates a JSONPath expression against your own JSON in the browser, showing the matches and how many there are as you type — an online tester and evaluator in one panel. Recursive descent ($..author), wildcards, array slices, index unions, filters such as $..book[?(@.price<10)], ~ for property names and .length all work. Useful for writing an assertion in an API test or pulling one field out of a long response. Errors appear inline, and results come back as a JSON array you can copy.

How to use the JSONPath Tester

  1. Paste your JSON into the JSON panel.
  2. Type an expression in the box at the top, starting with $.
  3. Watch the Results panel and the result count update on every keystroke.
  4. Press Copy to take the matched values as a JSON array.

Frequently asked questions

Why is the result always an array?
A JSONPath expression can match any number of nodes, so results are always wrapped in an array, even when exactly one node matches. $..book.length on the sample returns [2], not 2.
What happens when my expression matches nothing?
You get an empty array and a count of 0, not an error: a path that selects no node is still a valid query. Case matters, so $..Author returns [] on the sample where $..author returns both authors. An error only appears when the JSON will not parse, or the expression will not, as with an unclosed filter like $..book[?(@.price<10).
Why does count($..book) come back empty?
count() is XPath, not JSONPath, and JSONPath has no function calls. The expression matches nothing, so it returns [] with a count of 0 rather than telling you the function is unknown. For a length, use $..book.length; for the number of matches, read the result count beside the expression box.
What syntax is supported?
$ for the root, dot and bracket child access, .. for recursive descent, * wildcards, [1:3] slices, [0,2] unions, [?(@.price<10)] filters, ~ to return property names instead of values, and .length on an array.
Is JSONPath the same as jq or JMESPath?
No. They are separate query languages with different syntax and different capabilities. An expression written for jq will not run here, and vice versa.
Is my JSON uploaded?
No. The query runs in your browser, which is what makes it safe to paste a real API response containing customer data.

Related tools