JsonBro

JSONPath tester and evaluator

Type an expression, see the matches immediately, each labelled with its full path. No run button, no server round-trip, and the grammar is documented rather than guessed at.

Open the query →

Supported syntax

A practical subset rather than the full specification — this is the complete list, and the same table is available inside the app:

SyntaxMeaning
$the whole document
.keya property; use ['odd key'] when it contains spaces or dashes
[0]an array item; [-1] counts back from the end
[1:4]a slice; [:2] and [2:] also work
.* or [*]every child of an object or array
..keythat property at any depth
$..[?(…)]any node anywhere matching the test
$.list[?(…)]the members of list matching the test
@.fielda field of the node being tested
== != > >= < <=comparisons against a number, string, true/false or null
=~ "re"regular-expression match on a string
[?(@.flag)]nodes where the field is truthy

Worked examples

$..id                      // every id, however deeply nested
$.items[0:3]               // the first three items
$..[?(@.active == true)]   // every active node anywhere
$..[?(@.name =~ "^ab")]    // names starting with "ab"
$.users[-1].email          // the last user's email

Recursive descent is descendant-or-self, so $..[?(…)] tests the root as well as everything under it, and overlapping routes to the same node are reported once.

Not supported

Script expressions, unions of distinct paths ($['a','b']), parent navigation, and functions such as length(). If an expression is invalid you get a message saying why, not an empty result list that looks like "no matches".

Questions

What is JSONPath?

A query language for JSON, roughly what XPath is for XML. $ is the document root, dots and brackets walk into properties and array items, .. searches at any depth, and [?(…)] filters by a test.

How do I filter an array by a field value?

Use a filter expression: $.users[?(@.active == true)] returns the members of users whose active field is true. @ refers to the item being tested.

Why does my expression return nothing?

Usually a name that does not exist at that level, or a filter compared against the wrong type. Try the same path without the filter first, then add the test back — matches update as you type, so it is quick to narrow down.

Is the query run on a server?

No. Expressions are evaluated in a Web Worker in your browser, against the document you have open.

Try it with your own JSON →