JSONPath Syntax
$— root.keyor['key']— child..— recursive descent[*]— all elements[0]— first element[-1]— last element[0,2]— multiple indices
$ — root.key or ['key'] — child.. — recursive descent[*] — all elements[0] — first element[-1] — last element[0,2] — multiple indicesJSONPath is to JSON what XPath is to XML — a tiny, portable expression language for picking values out of a document without writing parser code. This tester implements the subset that covers the vast majority of real-world queries: $ root, .key and ['key'] for child access, [n] integer indices including [-1] for last-element, [*] wildcard over arrays and object values, and [a,b] index lists.
Both the path expression and the JSON payload are live — every keystroke reparses and re-evaluates so you can iterate on a query without clicking a button. Filters ([?(@.x>1)]) and recursive descent (..) are intentionally not implemented; if you need those, reach for a full library like jsonpath-plus or use jq. Invalid JSON or an unresolved path produces an inline error rather than a silent empty result.
A pragmatic subset: $ root, .key and ['key'] for child access, [n] integer indices, [-1] for last-element, [*] for wildcards over arrays and object values, and [a,b] for index lists. Filters ([?(@.x>1)]) and recursive descent (..) are not implemented — use a server-side JSONPath library for those.
JSONPath is portable across languages and tools (jq, Postgres jsonb_path_query, gateway routers, log queries) — the same expression works wherever JSONPath is supported. Hand-written JS access only works in JS.
No — recursive descent (..) is not part of the subset implemented here. For deep traversal, use a full library like jsonpath-plus on the server or the recursive form in jq.
The last element of an array. So $.book[-1] returns the last book object regardless of how many entries the array has — handy for log streams or feeds where you only care about the most recent item.
Explore the full suite of DEVELOPER tools and 290+ other free utilities at Chunky Munster.