What is JSONPath?

Published: 2026-05-17

A practical introduction to JSONPath—how to point at nested JSON, filters, and recursive descent—with links to LocalTools’ browser-only evaluator and formatter.

JSONPath is a compact query language for walking JSON trees. Where JSON describes one document, JSONPath answers questions like “give me every price under items” or “all objects where status is active” without hand-writing recursive JavaScript for each shape.

Mental model

Think of JSONPath as addresses inside parsed JSON (objects and arrays). Expressions usually start at $, the document root, then chain selectors—property names, array indices, wildcards, and special operators—until every matching node is collected.

{
  "store": {
    "book": [
      { "title": "Sensors", "price": 12.99 },
      { "title": "Maps", "price": 8.95 }
    ]
  }
}

Examples (syntax families vary slightly by implementation):

Expression Idea
$.store.book The book array
$.store.book[*].title Every title in the array
$..price Recursive descent: any price anywhere under the root

Common building blocks

  • Root: $ — start here on the whole value you parsed with JSON.parse.
  • Children: .name or ['name'] — step into an object property; brackets help when keys have spaces or symbols.
  • Arrays: [0], [*] for all elements, or slices like [0:3] depending on the engine.
  • Recursive descent: .. — “walk the subtree and collect matches,” handy for logs and uneven API payloads.
  • Filters: [?(@.price < 10)] — keep array elements (or nodes) where a predicate holds; @ often means “the current candidate.”

Results are usually a list of values (sometimes empty), because many paths match more than one place in the tree.

Implementations and “the spec”

JSONPath was first described by Stefan Gössner as a lightweight analogy to XPath. There is no single universally identical dialect: libraries extend filters, slices, and script features differently.

On LocalTools, the JSONPath evaluator runs jsonpath-plus in your browser with safe evaluation (no arbitrary script). That matches most day-to-day JSONPath tutorials, but if something behaves oddly, check the library’s notes for edge cases.

Try it without uploads

Paste JSON, type a path starting at $, and inspect matches in the JSONPath evaluator. If the payload is hard to read, format it first with the JSON Formatter & Validator—both tools keep your text local to the tab.

Related reading

All learn articles