How to query JSON by path

Most of the time you don't need the whole JSON document โ€” you need one field, or the same field across a list. Path expressions let you pull exactly that. Here are the practical patterns and examples you can paste and try.

The three patterns you'll use most

PatternMeans
.key or keyStep into an object's property
[0]The element at an array index
[*]Every element of an array (or every value of an object)

Examples

Given this JSON:

{
  "store": "Aurora",
  "orders": [
    { "id": 1, "total": 18.0, "items": ["espresso"] },
    { "id": 2, "total": 32.5, "items": ["cold brew", "mug"] }
  ]
}
PathResult
store"Aurora"
orders[0].total18
orders[*].id[1, 2]
orders[*].items[*]["espresso","cold brew","mug"]

Why this beats scrolling

On a large response, hunting for a value by eye is slow and error-prone. A path expression returns just what you asked for, and combined with a viewer you can confirm the shape first, then extract.

Try any of these live in the free JSONPath tester โ€” paste your JSON, type a path, see the result. For exploring big files first, open the JSON viewer; to dump an array to a spreadsheet, use the JSON โ†’ CSV converter.