JSONPath cheat sheet

The everyday JSONPath selectors at a glance, over the bookstore. Press ▶ to run one.

The document the examples run on
{
  "store": {
    "book": [
      { "title": "Sayings of the Century", "author": "Nigel Rees",
        "category": "reference", "price": 8.95 },
      { "title": "Sword of Honour", "author": "Evelyn Waugh",
        "category": "fiction", "price": 12.99 },
      { "title": "Moby Dick", "author": "Herman Melville",
        "category": "fiction", "price": 8.99, "isbn": "0-553-21311-3" },
      { "title": "The Lord of the Rings", "author": "J. R. R. Tolkien",
        "category": "fiction", "price": 22.99, "isbn": "0-395-19395-8" }
    ],
    "bicycle": { "color": "red", "price": 19.95 }
  }
}
QueryWhat it doesRun it
$the whole documentTry it
$.store.bicycle.colorchild segmentsTry it
$['store']['bicycle']bracket formTry it
$.store.book[0]an array elementTry it
$.store.book[-1]the last elementTry it
$.store.book[*].titleevery elementTry it
$.store.book[1:3]a slice (end exclusive)Try it
$.store.book[0,2]a union of indexesTry it
$.store.bicycle['color','price']a union of namesTry it
$..pricedescendants: at any depthTry it
$.store.book[[email protected] < 10]a filterTry it
$.store.book[[email protected]]an existence testTry it
$.store.book[[email protected] == 'fiction' && @.price < 13]combined conditionsTry it
$.store.book[?match(@.author, "^N")]a function in a filterTry it

All JSONPath lessons

About jsonquery

Query, format and learn JSON with jq, JSONPath, JMESPath and JSON Pointer. It is the engine of the desktop app, run in your browser.

Engine
The desktop app’s, compiled to WebAssembly
Licence
MIT (the engine and the app)
Source
GitHub
Contact
The contact form (private)
Public issues
GitHub
Legal
Privacy policy

Known limitations: a file over 10 MB opens read-only and one over 512 MB does not open here; the desktop app has no such limit.