A JSON navigator that tells you where every value is
In a large document, finding a value is easy with search, but knowing how to reach it from code is not. Is it book[2].isbn or store.book[2].isbn? Did you count the array index from zero? This JSON navigator removes the guesswork: it shows the document as a tree, and a click on any key, array item or branch writes out its full path from the root.
Example
Load the bookstore sample and type isbn in the filter box. The tree shrinks to the two books that have this field and the counter shows 2 matches. Click the first isbn key and the Path bar reads:
$.store.book[2].isbn string · 0-553-21311-3
Branches have paths too. Clicking other rows of the sample gives:
$.store.book array · [4]
$.store.book[2] object · {5}
$.store.book[0].price number · 8.95
Containers carry a note with their type and size, and each simple value is shown with its type, so you can tell the number 8.95 from a string holding the same digits. Copy path puts the path on the clipboard. Copy value copies what is stored there; for an object or array that is the whole branch as indented JSON.
How paths are written
$is the root of the document.- Keys that are valid identifiers (letters, digits,
_or$, not starting with a digit) use dot notation:$.store.bicycle. - Any other key uses brackets with a quoted name, for example
$.order["ship-to"]["zip code"]for keys containing a hyphen or a space. - Array elements use a zero-based index:
$.store.book[3]is the fourth book.
Using a path in your code
The notation is close to JavaScript, so most paths translate directly. The path $.store.book[2].isbn becomes:
| Where | Expression |
|---|---|
| JavaScript | data.store.book[2].isbn |
| Python | data["store"]["book"][2]["isbn"] |
| jq | .store.book[2].isbn |
| JSONPath | $.store.book[2].isbn |
To select the same field from every element instead of one, replace the index with a wildcard, as in $.store.book[*].isbn, and try it in the JSONPath tester.
Typical uses
- Writing a mapping or extraction rule for an integration tool that asks for a path.
- Referring to a precise field in a bug report or API documentation.
- Confirming whether a field sits inside an array, which means your code needs a loop, or directly under an object, which means a single lookup is enough.
- Spotting inconsistent records: in the sample, only
book[2]andbook[3]have anisbn, which is visible from the "5 keys" notes on those two rows. - Checking which fields a CSV export would produce, since the JSON to CSV converter flattens nested keys in a similar dotted style.
The JSON viewer page describes the same tree from the browsing side, with formatting and sorting. The document is read in your browser and is not uploaded unless you use Save & Share.