JSON Tools

JSONPath Tester: Test JSONPath Expressions and Queries Online

Test JSONPath expressions against real JSON data instantly. Debug queries for APIs, test automation, and data extraction pipelines.

Published January 15, 2025Updated June 1, 20255 min read

Try the free online tool

Runs entirely in your browser — no signup, no uploads.

Open Tool

JSONPath is to JSON what XPath is to XML — a query language for navigating and extracting data from a JSON document. With a JSONPath expression you can extract a specific field, filter array elements by value, aggregate data, or navigate deeply nested structures without writing code.

Testing JSONPath expressions is tricky without instant feedback. An online JSONPath tester lets you paste your JSON, type an expression, and see the matching results immediately — making it easy to iterate on complex queries without setting up a script or waiting for a test run.

This tool supports the full JSONPath specification including wildcards, recursive descent, array slices, and filter expressions. Use it to build queries for API testing tools like Postman, test automation frameworks like REST Assured, data extraction pipelines, and application code that uses JSONPath libraries.

What Is JSONPath?

JSONPath is a path expression language for selecting elements from a JSON document, defined by Stefan Goessner in 2007 and formalized in RFC 9535 (2024). It uses a dot-notation syntax inspired by XPath, where `$` represents the root of the document and subsequent segments navigate through objects and arrays.

A JSONPath expression consists of a root identifier (`$`), followed by a sequence of path segments: dot notation (`$.store.name`), bracket notation (`$["store"]["name"]`), wildcards (`$.items[*]`), array slices (`$.items[0:5]`), and filter expressions (`$.items[?(@.price < 10)]`).

JSONPath has wide library support: `jsonpath-ng` in Python, `jsonpath-plus` and `jsonpath` in JavaScript/Node.js, `Jayway JsonPath` in Java, and `System.Text.Json` with JSONPath in .NET. The syntax is consistent across these implementations for standard expressions, though edge cases differ.

  • `$` — the root element of the document
  • `$.key` — select the value of `key` on the root object
  • `$.items[*]` — select all elements of the `items` array
  • `$.items[0]` — select the first element of the `items` array
  • `$.items[0:3]` — select the first three elements (slice)
  • `$..name` — recursive descent: find `name` at any depth
  • `$.items[?(@.price > 10)]` — filter: items where price is greater than 10

How to Use This Tool

Paste your JSON document and type a JSONPath expression. Matching results appear instantly so you can iterate until the expression is correct.

  1. 1

    Paste your JSON

    Enter the JSON document you want to query in the JSON panel. This is typically an API response, a configuration file, or a test fixture.

  2. 2

    Enter a JSONPath expression

    Type your JSONPath expression in the expression field. Start with `$` (root) and build the path step by step.

  3. 3

    View matching results

    The matched nodes are displayed in the result panel. Multiple matches are shown as an array. A path with no matches shows an empty array.

  4. 4

    Iterate and refine

    Adjust the expression — add filters, wildcards, or array slices — and see the results update in real time. Use the path visualization to understand which nodes were selected.

  5. 5

    Copy the expression

    Once the expression returns the correct data, copy it for use in your API test, application code, or data pipeline configuration.

Common Use Cases

JSONPath is used wherever you need to extract or assert on specific data within a JSON document.

  • API test assertions — use JSONPath in Postman (`pm.response.json()`) or REST Assured to assert that specific fields in a response have expected values.
  • CI/CD pipeline data extraction — extract values from JSON outputs of CLI tools (like Terraform or AWS CLI) using `jq` (which uses a JSONPath-like syntax) in shell scripts.
  • GraphQL response parsing — JSONPath can extract specific fields from complex GraphQL JSON responses in test automation.
  • Application code data extraction — use JSONPath libraries to safely extract nested values from API responses without manually chaining property accesses.
  • Monitoring and alerting — configure alert rules in tools like Grafana or Datadog that use JSONPath to extract metric values from JSON log entries.

JSONPath Expression Reference

Here is a concise reference of the most commonly used JSONPath operators. Bookmark this as a quick reference when writing queries.

  • `$.store.book[0].title` — navigate a specific path to a single value
  • `$.store.book[*].author` — all authors from all books (wildcard)
  • `$..price` — all price values at any depth (recursive descent)
  • `$.store.book[?(@.price < 10)]` — books with price less than 10 (filter)
  • `$.store.book[-1]` — the last book in the array (negative index)
  • `$.store.book[0,2]` — first and third book (union)
  • `$.store.book[0:2]` — first two books (slice, exclusive end)

Frequently Asked Questions

What is the difference between `$.key` and `$..key`?

`$.key` selects the `key` property directly on the root object — only one level deep. `$..key` is the recursive descent operator and selects every `key` property at any depth in the entire document. Use `$..` carefully on large documents as it traverses every node.

How do I filter array elements by a property value?

Use a filter expression: `$.items[?(@.status == "active")]` selects all elements of `items` where the `status` property equals `"active"`. The `@` symbol refers to the current element being evaluated. You can use `==`, `!=`, `<`, `>`, `<=`, `>=`, and `=~` (regex match) operators.

Why does my JSONPath expression return an empty array?

Common causes: a typo in a key name (keys are case-sensitive), using dot notation on a key that contains spaces or special characters (use bracket notation instead: `$["my key"]`), an array index out of bounds, or a filter condition that no elements satisfy. Test each segment of the path incrementally to find where it fails.

Is JSONPath standardized?

JSONPath was informally defined by Stefan Goessner in 2007 and lacked a formal specification for years, leading to implementation differences. RFC 9535 (published February 2024) defines a standardized JSONPath specification. Older libraries may not fully comply with RFC 9535.

How do I use JSONPath in Python?

Install `jsonpath-ng`: `pip install jsonpath-ng`. Then: `from jsonpath_ng.ext import parse; expr = parse('$.items[*].name'); matches = [m.value for m in expr.find(data)]`. The `jsonpath-ng` library is one of the most complete implementations of JSONPath in Python.

How do I use JSONPath in Postman?

In a Postman test script, use `pm.response.json()` to get the parsed JSON, then navigate it with JavaScript property access. Postman also supports JSONPath in dynamic variable extraction: in the Tests tab, use `pm.environment.set('token', pm.response.json().data.token)` to extract and save a value.

What is the difference between JSONPath and jq?

`jq` is a full-featured command-line JSON processor with its own query language that goes far beyond JSONPath — it supports transformations, reductions, conditionals, and custom functions. JSONPath is a simpler read-only query language focused on selecting nodes. For shell scripts and data pipelines, `jq` is more powerful. For API testing tools that accept JSONPath, use JSONPath syntax.

jsonpathjsonjsonpath testerjson querydata extraction

Ready to use this tool?

Free, instant, no account required. Runs entirely in your browser.

Open Tool

More JSON Tools Guides