JSON Studio

What Is JSONPath?

Learn JSONPath syntax for querying and extracting data from JSON documents. Complete guide with examples, operators, and comparison with jq.

JSONPath is a query language for JSON, similar to what XPath is for XML. It lets you extract specific values from complex nested JSON structures using a simple dot-notation or bracket-notation syntax.

JSONPath Syntax

ExpressionDescription
$The root object
$.nameDirect child property
$.users[0]First element of array
$.users[*].nameName of every user
$..nameAll "name" fields at any depth
$.users[?(@.age > 25)]Filter: users older than 25

JSONPath Examples

Given this JSON:

{
  "store": {
    "books": [
      { "title": "Clean Code", "price": 29.99 },
      { "title": "The Pragmatic Programmer", "price": 39.99 }
    ]
  }
}

`$.store.books[*].title` → `["Clean Code", "The Pragmatic Programmer"]`

`$.store.books[?(@.price < 35)]` → books under $35

`$..price` → all prices at any depth

JSONPath vs jq

JSONPath uses dot notation ($.users[0].name) while jq uses pipe syntax (.users[0].name). JSONPath is more common in REST APIs and testing (Postman, REST Assured), while jq is preferred in shell scripting and CLI workflows.

Try It Yourself

Use our JSONPath Evaluator to test queries against your own JSON data, right in the browser.

J

Written by JSON Studio

Engineering Team