Cheatsheet: JsonPath

Last updated 2026-09-20

Objects and root

Select the root JSON value.

$

Select an object property with dot notation.

$.store

Select nested object properties.

$.address.city

Use bracket notation for property names with punctuation or spaces.

$['address']['postal-code']

Select multiple object properties at the same level.

$['firstName','lastName','email']

Arrays and wildcards

Select an array element by zero-based index.

$.carOptions[1]

Select the last array element using a negative index where supported.

$.items[-1]

Select all elements of an array with a wildcard.

$.items[*]

Select all property values of an object with a wildcard.

$.store.*

Select a property from every array element with a wildcard, e.g. every book's author.

$.store.book[*].author

Select a half-open array slice from index 1 up to but not including 4.

$.items[1:4]

Select every second item from an array where slice steps are supported.

$.items[0:10:2]

Reverse a fixed-length array by listing its indexes in reverse order (negative-step slicing like [::-1] is not supported by the site's JSONPath engine, jsonpath-plus, and returns an empty result).

$.items[9,8,7,6,5,4,3,2,1,0]

Select multiple array indexes.

$.items[0,2,4]

Recursive descent and filters

Find every price property anywhere in the document.

$..price

Find all author properties under any book objects.

$.store..author

Combine recursive descent with a wildcard to select every value in the document, at every depth.

$..*

Filter array items by a numeric comparison.

$.store.book[?(@.price < 10)]

Filter items that have an isbn property.

$.store.book[?(@.isbn)]

Filter with a string equality comparison.

$.store.book[?(@.category == 'fiction')]

Filter with multiple conditions where supported by the implementation.

$.store.book[?(@.price < 10 && @.category == 'fiction')]

Filter with an OR condition and inequality/range comparisons.

$.store.book[?(@.price <= 8.99 || @.price >= 22.99)]

Negate a filter condition.

$.store.book[?(!@.isbn)]

Filter using a regular expression where supported.

$.store.book[?(@.author =~ /.*Tolkien.*/)]

Filter using recursive descent combined with a condition to search at any depth.

$..book[?(@.price < 10)]

Functions and results

Get the length of a selected array where the implementation supports functions.

$.items.length()

Return the minimum price where aggregate functions are supported.

$..price.min()

Return the maximum price where aggregate functions are supported.

$..price.max()

Return the average price where aggregate functions are supported.

$..price.avg()

Return matching nodes and remember that exact function support varies between JSONPath libraries.

$..book[?(@.price)]

FAQ