JSONPath Tester
Paste JSON and a JSONPath query to see every match. Runs in your browser.
Pasted text and chosen files stay on this device. Nothing is sent to a server.
Drop a file here, choose one, or paste.
How to use it
- 1
Paste the document and the expression.
- 2
Read the count first — if it is not what you expected, the expression is the thing to change.
What it does
JSONPath selects nodes from a document. The two things that go wrong are selecting nothing and selecting more than expected, so the count is as much the answer as the values.
Parse the document, evaluate the expression, and return every match with its path. Report the count, and distinguish an empty match from a syntax error.
Why it works this way
An expression that matches nothing and an expression that is malformed produce very different situations, and a tester that shows an empty result for both has hidden the useful half.
The count matters because most JSONPath mistakes are over-selection: a wildcard that was meant to be narrow returns fifty nodes where one was expected, and the values alone look plausible.
The root expression selects the whole document. That is the degenerate case with an answer nobody has to compute, and it is what tells you the evaluator is wired to the document at all.
Examples
$.store.book[*].author
4 matches: $.store.book[0].author … [3].author
$.nope
0 matches (not an error)
Inputs and outputs
- JSON document
- JSONPath expression
- every matching node, with its path
- the match count
- or the expression error
Edge cases
- $ with no document
- malformed expression — error, not 0 matches
- recursive descent ..
- filters with comparisons
- matches inside arrays vs objects
Frequently asked questions
Is 0 matches an error?
No. It means the expression is valid and selected nothing, which is usually the useful answer. A malformed expression is reported separately as an error.
Why show the count?
Because over-selection is the common mistake and a list of matches hides how many there are.
Related tools
Sources
- RFC 9535, JSONPath: Query Expressions for JSON