Skip to content
Loading the editor only when it is ready

JSONPath Explorer — Query, Test & Debug JSONPath Expressions Online

Looking for a powerful yet simple way to query JSON data? This JSONPath Explorer lets you test, visualize, and debug JSONPath expressions against any JSON document — instantly in your browser with no server uploads.

JSONPath is to JSON what XPath is to XML. It is a query language that navigates JSON structures to extract specific values, arrays, or nested data.


What Is JSONPath?

JSONPath is a query language for JSON that lets you extract data from JSON documents using path expressions. Originally defined by Stefan Goessner in 2007, JSONPath has become the de facto standard for querying JSON in API testing, data transformation, and ETL pipelines.

A JSONPath expression always starts with $ representing the root object, followed by a sequence of selectors that navigate deeper into the document.

Basic Syntax

{
  "store": {
    "name": "Bookstore",
    "books": [
      { "title": "JSON for Beginners", "price": 12.99 },
      { "title": "Advanced JSONPath", "price": 24.99 }
    ]
  }
}
Expression Result
$.store.name "Bookstore"
$.store.books[0].title "JSON for Beginners"
$.store.books[*].price [12.99, 24.99]

Dot Notation vs Bracket Notation

JSONPath supports two syntaxes for accessing properties. Both are functionally equivalent but have different strengths.

Dot Notation

$.store.books[0].title

Dot notation is shorter and more readable for simple property names. Use it when property names are valid JavaScript identifiers.

Bracket Notation

$['store']['books'][0]['title']

Bracket notation is required when property names contain:

  • Special characters (spaces, hyphens, dots)
  • Unicode characters
  • Dynamic or computed keys

Example with special characters:

{ "first name": "John", "@metadata": { "version": 2 } }
$['first name']
$['@metadata']['version']

Wildcards (*)

The wildcard selector selects all properties or elements at a given level. This is useful when you want to iterate over everything without knowing the exact keys.

Wildcard Examples

{
  "users": {
    "alice": { "role": "admin", "email": "alice@example.com" },
    "bob": { "role": "user", "email": "bob@example.com" },
    "carol": { "role": "moderator", "email": "carol@example.com" }
  }
}
Expression Returns
$.users.* All user objects
$.users.*.role ["admin", "user", "moderator"]
$.users.*.email All email addresses

Filter Expressions

Filter expressions let you select array elements that match a condition. They use the syntax [?(@.property operator value)].

Supported Operators

Operator Meaning Example
== Equal [?(@.price == 20)]
!= Not equal [?(@.status != "inactive")]
< Less than [?(@.age < 18)]
> Greater than [?(@.price > 100)]
<= Less or equal [?(@.rating <= 3)]
>= Greater or equal [?(@.score >= 90)]
&& Logical AND [?(@.price < 50 && @.inStock == true)]
` `
=~ Regex match [?(@.email =~ /.*@example.com/)]

Practical Filter Examples

{
  "products": [
    { "name": "Laptop", "price": 999, "inStock": true, "rating": 4.5 },
    { "name": "Mouse", "price": 25, "inStock": true, "rating": 4.0 },
    { "name": "Keyboard", "price": 75, "inStock": false, "rating": 3.5 },
    { "name": "Monitor", "price": 299, "inStock": true, "rating": 4.2 }
  ]
}
$.products[?(@.price < 100 && @.inStock == true)]
// Returns: [{ "name": "Mouse", ... }]

$.products[?(@.rating >= 4.0)]
// Returns: Laptop, Mouse, Monitor

$.products[?(@.name =~ /^M/)]
// Returns: Mouse, Monitor

Recursive Descent (..)

Recursive descent searches through all nested levels of a JSON document. This is one of the most powerful JSONPath operators.

How Recursive Descent Works

{
  "id": 1,
  "metadata": {
    "created": "2024-01-01",
    "price": 29.99,
    "details": {
      "weight": "1.5kg",
      "price": 24.99
    }
  },
  "price": 19.99
}
$..price
// Returns: [19.99, 29.99, 24.99] — all price values at any depth

$..metadata
// Returns: the entire metadata object including nested details

$..*
// Returns: all values in the entire document (full flattening)

Use Cases for Recursive Descent

  • Unknown document structure: When you don't know how deeply a field is nested
  • Schema-less data: MongoDB documents, Firebase data, or loosely typed JSON
  • Finding all values of a key: Extract every occurrence of email, id, or name

Array Slicing

Array slicing lets you select a subset of array elements using [start:end:step].

Slice Syntax

{
  "items": ["a", "b", "c", "d", "e", "f", "g", "h"]
}
Expression Result Description
$items[0:3] ["a", "b", "c"] First 3 elements
$items[3:] ["d", "e", "f", "g", "h"] From index 3 to end
$items[:3] ["a", "b", "c"] Same as [0]
$items[-3:] ["f", "g", "h"] Last 3 elements
$items[::2] ["a", "c", "e", "g"] Every other element
$items[1:7:2] ["b", "d", "f"] Step of 2 from index 1
$items[::-1] ["h", "g", "f", "e", "d", "c", "b", "a"] Reversed array

Union and Multiple Selectors

JSONPath supports combining multiple paths into a single result.

$.store.books[0,1,2]
// Returns first three books

$.store.books[0]['title', 'price']
// Returns title and price of the first book

$.store.books[?(@.price > 10)]['title', 'author']
// Returns title and author of all books over $10

Practical JSONPath Examples

Example 1: E-Commerce API Response

{
  "status": "success",
  "data": {
    "order": {
      "id": "ORD-12345",
      "customer": {
        "id": 42,
        "name": "Jane Doe",
        "email": "jane@example.com"
      },
      "items": [
        { "sku": "LAP-001", "name": "Laptop", "qty": 1, "price": 999 },
        { "sku": "MOU-003", "name": "Mouse", "qty": 2, "price": 25 }
      ],
      "total": 1049,
      "shipping": {
        "address": { "city": "San Francisco", "zip": "94105" },
        "status": "shipped"
      }
    }
  }
}
$.data.order.customer.email                      → "jane@example.com"
$.data.order.items[*].name                       → ["Laptop", "Mouse"]
$.data.order.items[?(@.qty > 1)].sku             → ["MOU-003"]
$.data.order.shipping.address.city               → "San Francisco"
$.data.order..price                               → [999, 25]
$.data.order.items[?(@.price > 100)].name         → ["Laptop"]

Example 2: Nested Configuration

{
  "app": {
    "name": "MyApp",
    "version": "2.1.0",
    "features": {
      "auth": { "enabled": true, "provider": "oauth2" },
      "logging": { "enabled": true, "level": "debug" },
      "cache": { "enabled": false, "ttl": 300 }
    },
    "database": {
      "host": "localhost",
      "port": 5432,
      "credentials": {
        "user": "admin",
        "password": "secret"
      }
    }
  }
}
$.app.features.*.enabled                        → [true, true, false]
$.app.features[?(@.enabled == true)].^           → ["auth", "logging"]
$.app.database.credentials.user                  → "admin"

Use Cases for JSONPath

API Testing and Validation

Test REST API responses by extracting specific values and asserting their types and values.

$.results[0].id          → Extract first result ID
$.total_results           → Get the total count
$.results[*].name         → Get all names from results

Data Transformation (ETL)

Extract and reshape data from complex JSON documents before loading into databases.

Configuration Management

Query deeply nested configuration objects for specific keys and values.

CI/CD Pipeline Debugging

Parse and inspect JSON outputs from build tools, deployment logs, and cloud provider APIs.

MongoDB and NoSQL Querying

Many NoSQL databases use JSON-like querying patterns similar to JSONPath for document retrieval.

GraphQL Response Parsing

GraphQL responses are JSON — use JSONPath to quickly extract nested fields during development.


JSONPath vs JMESPath

Feature JSONPath JMESPath
Root selector $ @
Recursive descent .. *
Built-in functions No Yes (length(), sort(), join())
Filter syntax [?(@.x > 1)] [?x > '1'] (projection)
Pipe support Limited `
Best for Simple path queries Complex transformations

JSONPath FAQs

What is JSONPath used for?

JSONPath is used to query and extract specific values from JSON documents, similar to how XPath works for XML. It is commonly used in API testing, data transformation, ETL pipelines, and debugging JSON responses from REST and GraphQL APIs.

How do I use the JSONPath Explorer?

Paste or upload JSON data in the left panel, type a JSONPath expression in the query bar starting with $, and see matching results instantly. Use the Tree Explorer to discover paths by clicking on nodes. The match count and result preview update in real time.

What JSONPath syntax is supported?

The explorer supports dot notation ($.store.books[0].title), bracket notation ($['store']['books'][0]['title']), wildcards (*), recursive descent (..), array slicing ([0:3]), filter expressions ([?(@.price > 10)]), and union selectors.

Is my JSON data uploaded to a server?

No. All processing happens 100% in your browser. Your JSON never leaves your computer. This is a privacy-first tool built for developers who work with sensitive data.

What is the difference between dot notation and bracket notation?

Dot notation ($.store.book) is shorter and preferred for simple property names. Bracket notation ($['store']['book']) supports special characters, spaces, and dynamic keys. Both are interchangeable.

How do filter expressions work in JSONPath?

Filter expressions use [?(@.property operator value)] to select array elements matching a condition. Supported operators include ==, !=, <, >, <=, >=, &&, ||, and regex matches with =~.

What is recursive descent in JSONPath?

Recursive descent (..) searches through all nested levels of a JSON document, similar to // in XPath. For example, $.store..price finds all price values at any depth within the store object.

Can I test JSONPath against API responses?

Yes. Paste any API JSON response — from REST APIs, GraphQL, Firebase, or MongoDB — into the editor and test your JSONPath expressions against it.

Does the tool support array slicing?

Yes. Array slicing uses the syntax $[start:end:step]. For example, $[0:5] selects the first 5 elements, $[::2] selects every other element, and $[-3:] selects the last 3 elements.

How do I discover JSONPath expressions interactively?

The Tree Explorer lets you click on any node in the visualized JSON structure, and it shows the corresponding JSONPath expression to reach that node. This is the easiest way to learn JSONPath.

Can I use wildcards in JSONPath?

Yes. The wildcard (*) selects all elements at a given level. For example, $.store.* selects all properties of store, and $.store.books[*].author selects the author of every book.

What is the difference between JSONPath and JMESPath?

JSONPath uses $ as the root selector and supports recursive descent (..), while JMESPath uses @ for current node and has built-in functions like length() and sort(). This tool follows Stefan Goessner's original JSONPath specification.


Related Tools

  • JSON Formatter & Validator — Format, validate, and prettify JSON data
  • JSON to CSV Converter — Transform JSON arrays into CSV format
  • JSON Diff Checker — Compare two JSON documents side by side
  • JSON Path Generator — Generate JSONPath expressions from visual tree selection
  • XML to JSON Converter — Convert XML documents to JSON format
  • API Response Viewer — View and navigate API responses with syntax highlighting

Start querying your JSON data with JSONPath today — fast, private, and entirely browser-based.

Related Tools

Try these complementary developer tools:

Popular Developer Tools

Most-used tools on LangStop