What is JSONPath?

JSONPath is a query language for JSON, similar to how XPath works for XML. It lets you navigate and extract data from a JSON structure using path expressions. A JSONPath expression starts with $, which represents the root of the document, and uses dot notation (.key) or bracket notation (['key']) to traverse objects, and [index] to access array elements.

JSONPath was originally described by Stefan Gössner in 2007 and has since become a widely used standard in APIs, testing frameworks, and data processing pipelines. It is supported in many languages and tools, including JavaScript, Python, Java, and databases like PostgreSQL and MySQL.

Tool description

This tool lets you paste any valid JSON document and write a JSONPath expression to query it. Results are displayed instantly as you type, showing all matching values as a formatted JSON array. The match count is shown separately so you can quickly verify how many nodes were selected.

Examples

Input JSON:

{
  "store": {
    "book": [
      { "title": "Moby Dick", "price": 8.99, "category": "fiction" },
      { "title": "War and Peace", "price": 12.5, "category": "fiction" },
      {
        "title": "A Brief History of Time",
        "price": 7.99,
        "category": "science"
      }
    ]
  }
}
Expression Result
$.store.book[*].title All book titles
$.store.book[0] First book object
$.store.book[?(@.price < 10)] Books cheaper than $10
$.store.book[?(@.category == "fiction")] Fiction books only
$..price All price values anywhere in the document

Features

  • Real-time evaluation — results update as you type the expression or edit the JSON
  • Displays match count in a dedicated field
  • Copy button on the expression field for quick reuse
  • Paste button for quickly inserting JSON or expressions from clipboard
  • Error reporting for invalid JSON or malformed path expressions

How it works

JSONPath expressions are evaluated against the parsed JSON using the jsonpath-plus library. The $ symbol refers to the root element. Child nodes are accessed with . or [], wildcards with *, recursive descent with .., and filters with [?(...)]. The result is always an array of matching values, even if only one match is found.

Options explained

Syntax Meaning
$ Root element
.key or ['key'] Child property
[*] All array elements
[0] First array element (zero-indexed)
[-1] Last array element
[0,2] Elements at index 0 and 2
[0:2] Elements from index 0 to 1 (slice)
..key Recursive descent — find key at any depth
[?(@.price > 5)] Filter — elements where price is greater than 5
@ Current node (used inside filter expressions)

Use cases

  • API development — verify that a JSONPath selector used in a REST client, test suite, or data mapping tool extracts the expected fields from an API response
  • Data transformation — identify which values to extract from nested JSON payloads before writing a transformation script
  • Learning JSONPath — experiment with path syntax interactively to understand how operators like .., [*], and [?()] behave on real data

Tips

  • Use $..* to get every single value in the entire document — useful for exploring unknown JSON structures.
  • Filter expressions support comparisons (==, !=, <, >, <=, >=) and can reference nested properties: [?(@.author.name == "Rees")].
  • To match a property regardless of its depth, use .. recursive descent: $..title finds all title fields anywhere in the document.