A marketplace feed, a supplier catalogue or your own store's export lands as JSON: hundreds of products, each with a name, a price and a stock count. The question you need answered is small. What are the prices? Checking by eye means scrolling a wall of brackets, and copying values into a spreadsheet by hand means at least one of them will be wrong.

JSONPath exists for exactly this shape of problem. It is a small query language for JSON: you write a path, the path walks the document, and every value it lands on comes back as a list. This guide uses the free JSONPath Tester on Ovatly to pull every price out of a product list in one expression, plus the related expressions you will reach for next. Everything runs in your browser, so the feed is never uploaded.

Contents

  • Quick answer
  • The shape of the job: one field, many items
  • The wildcard: stepping into every item at once
  • Three worked examples on one product list
  • The honest limit: there are no filters here
  • How to pull prices, step by step
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

To pull every price from a product JSON: paste the JSON into the JSONPath Tester with a path that enters every item of the products array with the wildcard [*], then ends at the price key, for example $.store.products[*].price. The tester returns one list holding every price, in document order. Use an index such as [0] instead of the wildcard when you want one product's price, and swap the final key when you want a different field from every item. What the tester cannot do is filter: selecting only items priced under 10 is not supported, so collect the values first and read the list.

The shape of the job: one field, many items

JSONPath expressions start at $, which stands for the root of the document. From there each step moves one level: .store enters the store object, .products enters the array inside it. A plain path such as $.store.products stops at the array itself. To read a field, the path has to get inside the items, and an array offers two ways in: an index for one item, or the wildcard for all of them.

That is the mental model. A path is a route, and the answer is whatever the route lands on, once or many times. Prices are the classic case because the field name repeats in every item; any repeated field works the same way, which is why the third worked example below needs nothing new.

The wildcard: stepping into every item at once

The wildcard is written [*] and means every element at this level. Put it after an array and the rest of the path runs once per item, collecting a result from each. The wildcard also works over objects, entering every value an object holds, though arrays are the case that matters here.

End the path with the field you want. [*].price collects the price of every item the wildcard entered. Leave the field off and you collect the items themselves. The tester supports a defined subset of JSONPath: dot access for child keys, indexes, the wildcard, bracket keys for names with spaces or dots, and recursive descent. That subset covers field collection completely.

Three worked examples on one product list

Here is a small product list in the same store shape as the tester's own example, which uses $.store.book[*].title to return Dune, Emma:

{
  "store": {
    "products": [
      { "name": "Dune", "price": 12.99, "stock": 14 },
      { "name": "Emma", "price": 9.5, "stock": 0 },
      { "name": "Foundation", "price": 15, "stock": 7 }
    ]
  }
}

Every price at once. The headline expression:

$.store.products[*].price

It returns one list with a price per product, in document order:

12.99, 9.5, 15

One product's price. Replace the wildcard with an index. Indexes count from zero, so [0] is the first item:

$.store.products[0].price

That returns a single value, 12.99, the price of Dune.

A different field from every item. Keep the route and change only the last step:

$.store.products[*].name

That returns Dune, Emma, Foundation. The same swap gives you every stock count with $.store.products[*].stock.

The honest limit: there are no filters here

In full JSONPath, a filter selects items by a condition:

$.store.products[?(@.price < 10)]

This tester does not support filters. It also leaves out slices such as [0:2], scripts and unions. Type any of those and you get a clear error naming the unsupported part, not a silently wrong answer.

So the workflow is collect, then read. Pull all the prices into one list and scan it. For a catalogue of thousands that is a real limit, and a filter-capable tool would serve you better. For the common job, checking one feed before you publish it, the collected list is usually short enough to read at a glance, and it has one virtue a filter lacks: it shows you every value, including the one typed as 1299 instead of 12.99.

How to pull prices, step by step

  1. Open the JSONPath Tester and paste your product JSON into the input.
  2. Build the path level by level from the root: $, then each object key down to the products array, checking the spelling against the document as you go.
  3. Add [*] after the array, then the field key, giving a full expression such as $.store.products[*].price.
  4. Read the result list and count it. The list should hold one value per product; a short count means some item is missing the field or nests it deeper.
  5. Adjust as needed: swap [*] for an index to inspect one product, or change the final key to collect a different field.

Limitations and honest tradeoffs

The supported subset is deliberate and small. Filters, slices, scripts and unions are out, and the tester says so with an error that names the part it cannot run. If your question is conditional, only items under a price or in stock, this is the wrong tool for the final step.

Zero matches is a valid result, not an error. A path with a mistyped key returns an empty list, which can look like success. Check the spelling of each level against the document before you trust an empty answer.

The tester returns values, not their items. A list of prices does not say which product each price belongs to. When the pairing matters, pull the names with the same route, as the third worked example does, and read the two lists side by side.

Common mistakes

  • Forgetting the wildcard. $.store.products.price asks an array for a price key it does not have, and returns nothing. Arrays need [*] or an index before the field.
  • Counting indexes from one. [0] is the first item, [1] the second. An off-by-one here quietly prices the wrong product.
  • Expecting a filter to work. [?(@.price < 10)] produces an error naming the unsupported part, by design. Collect first, then read.
  • Reading an empty result as proof. Zero matches often means a typo in the path, not a missing field. Verify the key names in the document.
  • Assuming the results are sorted. Values come back in document order, not in price order.

FAQs

How do I get every price from a JSON product list at once? Use a path that enters every item of the array with the wildcard, then ends at the price key: $.store.products[*].price for a store-shaped feed. The tester returns one list holding every price, in document order.

Can I select only the products under a certain price? No. Selecting items by a condition needs a filter expression such as [?(@.price < 10)], and filters are not in this tester's supported subset. Typing one gives a clear error naming the unsupported part. Collect the prices first, then read the list.

What does it mean when my expression returns nothing? Zero matches is a valid result, not an error. It usually means a key name in the path does not match the document, often a typo or a level you skipped. Check each step against the JSON before assuming the field is absent.

How do I read a key whose name contains a space or a dot? Use bracket notation instead of dot notation: $['my key'] or $.store['price list']. Bracket keys are part of the supported subset and exist exactly for names that dot notation cannot express.

Is my JSON uploaded to a server? No. The tester runs fully in your browser and the JSON never leaves your device. You can disconnect from the internet after the page loads and the tool still works.

Conclusion

Pulling a field out of a JSON feed is a routing problem: get the path inside every item with the wildcard, end it at the field, and read the collected list. The JSONPath Tester covers that job in the browser, and it is honest about the boundary, filters included. When the field you need sits at different depths, the companion guide on recursive descent in JSONPath covers the .. operator that finds a key wherever it hides. For more guides, see our Data and JSON Tools guides.

References