Our implementation is based on the Stefan Gössner’s JSONPath article. Not all features are supported, though, as described below.

All sample JSON Path requests below are made over the Store Example which is a slightly modified version of the Goessner’s example.

Start Symbol

Every JSON path should start with $ ($.store, $.store.book, etc), which means the root of the source JSON tree. Starting with @ (“the current object/element”) is not currently supported.

Accessing Fields

This can be done either with dot notation ($.store.book) or index notation ($['store']['book']) or combination of them ($.store['book'], $['store'].book). Each of these examples returns identical results – list of all items within the book store:

[{"category": "reference", "author": "Nigel Rees", "title": ..., ...}, ... ]

Note that if the index notation is used then the dot symbol cannot be placed before the index opening brace: $.store.['book'] – this is not supported.

Accessing Elements of Lists

This is done with the index-notation only: $.store.book[0] return the first book in the store:

{"category": "reference", "author": "Nigel Rees", "title": ..., ...}

Selecting multiple entries

One level selection can be done with the star symbol * in both dot and index notations. Recursive selection can be done with the double-dot .. accessor only.

For example: $.store.book.* or $.store.book[*] selects all field values of the book store entries as flat list:

["reference", "Nigel Rees", "Sayings of the Century", 8.95, "fiction", "Evelyn Waugh", ...]

Consequently, the subsequent index accessor can be used to retrieve an element of the list: $.store.book.*[1] produces “Nigel Rees”. Note that there is no dot . between star * and subsequent [1] accessors.

Since $.store.book.* produces flattened list of all field values within the book store, it isn’t possible to select specific fields with star * accessor. For example: $.store.book.*.price returns an empty list but not all price values as one may expect.

Nevertheless, selecting specific fields can be done with the recursive .. selector, e.g. $.store.book..price returns all the prices within the book store:

[8.95, 12.99, 8.99, 22.99]

Consequently, $.store..price returns all prices within all stores.


Store Example

  "store": {
    "book": [
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
        "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
    "bicycle": [
        "color": "red",
        "wheels": 2,
        "price": 19.95
        "color": "blue",
        "wheels": 3,
        "price": 9.95
        "color": "black",
        "wheels": 1,
        "price": 49.95