About the JSONPath Tester
JSONPath selects values from a JSON document the way XPath does for XML. $ is the root, .name or ['name'] selects a property, [0] an array item, * every child and .. searches at any depth. [0,1] is a list of indexes, [1:3] a slice (start, end, step) and [-1:] the last item. Example: $.store.book[*].author returns the author of every book.
Filters keep the items for which a condition is true: $..book[?(@.price < 10)], where @ is the current item and @root the whole document. Conditions can use comparisons, &&, ||, ! and methods of the value such as @.title.match(/of/i) or @.tags.includes('x'). [?(@.isbn)] keeps the items that have the property. The expression is evaluated with jsonpath-plus in its safe mode: filter scripts are parsed and interpreted, never passed to eval, and they cannot reach anything outside the document.
Each match is listed with its normalized path, for example $['store']['book'][0]['title'], which identifies exactly one value. The output holds the values, the paths or both as JSON. This engine follows the original JSONPath article by Stefan Gössner with some extensions: ~ returns property names and ^ the parent. It differs from RFC 9535 in places: filters need parentheses, [?(@.price < 10)], and functions such as length() or match() are written as JavaScript properties and methods.
How to use it
- Paste a JSON document or open a .json file.
- Type an expression, or click one of the examples.
- Read the matches: path, type and value.
- Choose values, paths or both, then copy or download the JSON.