All cheat sheets

JSONPath

JSONPath quick reference for root paths, property selectors, array indexes, wildcards, recursive descent, unions, and slices supported by the OCMA tester.

Cheat Sheet

A JSONPath query starts at $ and selects properties or array elements. This sheet documents the subset evaluated by the OCMA JSONPath Tester. It is not a complete list of operators in the JSONPath standard (RFC 9535).

Sample document

Use this object to check each expression and its result below.

{
  "store": {
    "book": [
      { "title": "Sayings of the Century", "author": "Nigel Rees", "price": 8.95 },
      { "title": "Sword of Honour", "author": "Evelyn Waugh", "price": 12.99 },
      { "title": "The Lord of the Rings", "author": "J.R.R. Tolkien", "price": 22.99 }
    ],
    "bicycle": { "color": "red", "price": 19.95 }
  }
}

Build a path from the root

ExpressionResultWhat it selects
$The whole documentRoot object or array
$.store{ "book": […], "bicycle": {…} }Property store at the root
$.store.bookThe array of booksA nested object property
$.store.book[0].title["Sayings of the Century"]Property of the first array item
$.store['book']The array of booksQuoted-key form for an object property

Dot notation is concise for simple names. Use brackets for array indexes or keys that need quoting.

Array selectors

ExpressionResult for the sampleBehavior
$.store.book[0]First bookIndexes start at zero
$.store.book[-1].title["The Lord of the Rings"]Negative index counts back from the end
$.store.book[*].author["Nigel Rees", "Evelyn Waugh", "J.R.R. Tolkien"]Wildcard selects every array item
$.store.book[0,2].title["Sayings of the Century", "The Lord of the Rings"]Union of numeric indexes
$.store.book[1:3].title["Sword of Honour", "The Lord of the Rings"]Start included; end excluded
$.store.book[0:3:2].title["Sayings of the Century", "The Lord of the Rings"]Positive step skips items

Wildcards & recursive descent

$.store.book[*].price

[8.95, 12.99, 22.99]

Wildcard over the book array, then select each price.

$.store.*

The book array and bicycle object

Wildcard over the immediate values of the store object.

$..price

[8.95, 12.99, 22.99, 19.95]

Find every price property, including the nested bicycle price.

$..author

["Nigel Rees", "Evelyn Waugh", "J.R.R. Tolkien"]

Find author properties without naming the store.book path.

Recursive descent searches descendants at any depth. If the same property name occurs in more than one branch, expect more than one result; use a longer path to narrow the selection.

Result and error checks

What you seeCheck
JSON parse errorFix the input first: JSON requires quoted property names and does not allow trailing commas.
[] with no matchesCheck spelling, capitalization, whether a value is an object or array, and whether the operator is supported.
Several values returnedA wildcard or recursive descent may be selecting more branches than intended.
Unexpected single result shapeMatches are always presented as a JSON array, even when there is only one value.
Try one of these paths →Paste the sample JSON, enter an expression, and inspect the matching values in your browser.

For a worked explanation of each selector, read JSONPath Queries: Select Values from Nested JSON.

OCMA Tools

Free developer tools. Most features run client-side, your data stays in your browser. Optional accounts unlock extra features.

Most tools run client-side

© 2026 OCMA Tools — Free developer tools

built for developers, by developers