JSONPath Evaluator and Tester
Run a JSONPath expression against your JSON and see every match as a JSON array. Expressions are evaluated by the jsonpath-plus library, which follows the original Goessner JSONPath syntax with some extensions.
Related Developer Tools
Runs in your browser: your files and text are not uploaded. Free, no account needed.
Last updated: · Reviewed by the QuickTooly Team
Syntax and examples
Supported Syntax
$,@: the root document, and the current item inside a filter..key,['key']: child by name. Use brackets for keys with spaces or dots...: recursive descent.$..pricefinds everypriceat any depth.*: every child of an object or array.[0],[-1:],[0:2],[0,2]: index, slice and union. Negative numbers count from the end in slices.[?(...)]: filter, for example[?(@.price < 10 && @.title != "A")].- jsonpath-plus extensions:
~returns property names,^the parent, and@property,@parent,@rootcan be used in filters.
Worked example
JSON:
{"store":{"book":[
{"title":"A","price":8},
{"title":"B","price":12},
{"title":"C","price":5}
]}}$.store.book[?(@.price < 10)].titlereturns["A","C"].$..pricereturns[8,12,5].$.store.book[-1:]returns the last book,[{"title":"C","price":5}].$.store.book[*]~returns the array indexes[0,1,2].
Differences From RFC 9535
RFC 9535 standardised JSONPath in 2024. jsonpath-plus predates it, and some RFC forms behave differently here:
- Write filters with parentheses:
[?(@.price < 10)]. The RFC form[?@.price < 10]returns no matches and no error. - RFC functions such as
length(),count()andmatch()are not available and raise "JSONPath error: length is not defined". - Filter expressions run in the library's "safe" evaluator, which supports JavaScript-style operators such as
==,===,&&and||without callingeval.
JSONPath Questions
Why do I get an empty array instead of an error?
A path that matches nothing is not an error in JSONPath. Check key spelling and case, and whether the value you want sits inside an array that needs [*].
Why is a single value wrapped in an array?
jsonpath-plus always returns a list of matches, even when there is one. Use the first item of the array in your own code.
Can I leave out the leading $?
Yes. jsonpath-plus treats store.book[0].title the same as $.store.book[0].title.
Related Tools
- JSON to CSV Converter: export the matched array of objects to a spreadsheet.
- JSON Compare: compare the same extracted part of two responses.
- YAML to JSON Converter: convert YAML so you can query it here.