JSON Forge
100% Client-Side: your data is never sent to a server

JSONPath Cheat Sheet

JSONPath selects values from a JSON document. The expressions below were run against the engine used by the JSONPath tester, with a bookstore sample.

Operators

SyntaxMeaningExample
$The root of the document$
. or ['key']Child key (brackets for keys with spaces or dots)$.store.book or $['store']['book']
[n]Array item by index, starting at 0$.store.book[0]
[*] or .*Every child$.store.book[*].author
..Recursive descent: search at any depth$..price
[a,b]Union of indexes or keys$.store.book[0,2].title
[start:end]Slice, end excluded$.store.book[0:2].title
[-1:]The last item (negative start in a slice)$.store.book[-1:]

Filters

Inside [?( )], @ is the item being tested. Strings must be quoted.

SyntaxMeaningExample
[?(@.k < n)]Compare a number$.store.book[?(@.price < 10)].title
[?(@.k == 'x')]Compare a string$.store.book[?(@.category == 'fiction')].title
[?(@.k)]Key exists$..book[?(@.isbn)].title
&& and ||Combine conditions$.store.book[?(@.price < 10 && @.inStock == true)].title

Results on the sample bookstore

ExpressionReturnsCount
$.store.book[*].authorall authors4
$.store.book[?(@.price < 10)].titletitles of books under 103
$..priceevery price, at any depth5
$.store.book[0,2].titlefirst and third title2

Good to know

Try JSONPath expressions · All cheat sheets · JSON examples