Skip to main content
AllDevToolsHub
πŸ”Ž

JSONPath Tester

100% Local

Test JSONPath expressions against JSON data with live results.

JSONPath Tester
4 matches
[ "Sayings of the Century", "Sword of Honour", "Moby Dick", "The Lord of the Rings" ]
$Root element
.Child operator
..Recursive descent (all descendants)
*Wildcard (all elements)
[n]Array index
[start:end]Array slice
[?(@.key)]Filter, key exists
[?(@.price < 10)]Filter, comparison
[?(@.cat == 'x')]Filter, equality
[0,2]Union of indices
Try:

Privacy note

This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

How to Use JSONPath Tester

01

Paste JSON

Paste the JSON document you want to query into the input panel.

02

Enter JSONPath

Type a JSONPath expression like $.store.books[*].author to extract fields.

03

See Results

Matching values appear instantly in the results panel with their paths.

04

Copy Output

Copy the extracted values as JSON for use in code or scripts.

JSONPath Tester: the essentials

The JSONPath Tester evaluates JSONPath expressions like $.store.book[?(@.price < 10)].title against a live JSON document and shows matched values instantly. Supports dot/bracket notation, recursive descent (..), wildcards, slices, unions, and filter expressions.

Key points

  • JSONPath is read-only and modeled on XPath, to modify a document use jq or RFC 6902 JSON Patch, not JSONPath.
  • Filter expressions require the `@` current-element reference: `?(@.price < 10)` works, `?(price < 10)` silently matches nothing in most engines.
  • Recursive descent `..` walks every node in the document and is fine on a 1 MB payload but noticeably slow on 50 MB with deep nesting, prefer explicit paths when you know the shape.
  • String literals in filters must be quoted: `?(@.status=='admin')` matches, `?(@.status==admin)` is parsed as an identifier and fails.

When to use it

  • Writing a Postman or Cypress assertion like `pm.expect(...).to.have.jsonPath('$.data.id')` and verifying the expression matches before committing the test.
  • Building a `kubectl get pods -o jsonpath='{.items[*].metadata.name}'` query for a shell script and confirming the path against a real cluster response.
  • Extracting every nested error message from a multi-page log dump with `$..errors[*].message` without writing throwaway parsing code in Python or Node.
  • Filtering an e-commerce catalog response down to a price band with `$..items[?(@.price >= 10 && @.price < 50)]` to verify a tier-pricing rule before shipping it.

Common mistakes

  • Confusing JSONPath with JMESPath because both query JSON, AWS CLI and Boto3 use JMESPath (`users[?active].email`), while kubectl and Postman use JSONPath (`$.users[?(@.active)].email`).
  • Forgetting the `@` inside filters and writing `?(price < 10)`, some engines throw, others return an empty set, and you waste time blaming the data.
  • Comparing ISO timestamp strings with `>` and assuming numeric ordering, string comparison works only because ISO 8601 sorts lexicographically; localized date strings will not.
  • Reaching for recursive descent `$..price` on every query when an explicit path `$.store.book[*].price` is both faster and immune to accidentally matching an unrelated nested `price` field.
Overview

What is JSONPath Tester?

Test JSONPath expressions against any JSON document in real time. Supports wildcards, recursive descent, slices, unions, and filters like ?(@.price < 10).
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

JSONPath Tester

Enter a JSON document and a JSONPath expression to extract matching values in real time. Supports the full JSONPath syntax: dot notation, bracket notation, wildcards, recursive descent, array slices, unions, and filter expressions like ?(@.price < 10). Includes a syntax reference and common expression presets.

JSONPath is how you extract $.items[*].sku from a 2 MB response without writing a script. Dialects differ between Jayway, Goessner, and PostgreSQL.

On {"items":[{"sku":"A"},{"sku":"B"}]}, $.items[*].sku should return A and B. $..sku walks nested copies too.

If a filter expression works in Jayway and fails here, the engine is not the same. Do not copy-paste production queries blindly.

JSONPath: A Query Language for JSON

If you've ever needed to pull a specific field from a deeply nested API response, every user's email from a paginated list, every error message from a multi-page log dump, every product price above a threshold, JSONPath is the most concise way to do it. It's a small, expressive language designed to query JSON the way XPath queries XML, and it ships with most major API and infrastructure tools.

The Core Syntax in Five Minutes

  • $, the root of the document.
  • ., child access ($.user.name).
  • [n], array index access ($.items[0]).
  • [*], all children ($.items[*].price).
  • .., recursive descent: search at every depth ($..price finds every "price" anywhere).
  • [start:end:step], array slice, Python-style ($.items[0:5] is the first 5 items).
  • [n,m], union of indices ($.items[0,2,4]).
  • ?(condition), filter, with @ as the current item ($.items[?(@.price < 10)]).

These nine constructs cover the vast majority of real-world queries.

Filter Expressions: The Powerful Part

Filters take JSONPath from "pluck this field" to "pluck this field where some condition holds":

  • $..items[?(@.price < 10)], every cheap item, anywhere in the document.
  • $.users[?(@.active==true && @.roles[*]=='admin')], active admin users.
  • $.events[?(@.timestamp > '2024-01-01')], events newer than a date (string comparison if timestamps are ISO strings).
  • $.orders[?(@.total >= @.tax * 10)], orders where total is at least 10Γ— the tax.

The @ always means "the current element being filtered." Most beginners forget it and write ?(price < 10), which silently doesn't match anything in some engines and errors in others.

Real-World Uses

  1. API testing. Postman lets you assert with JSONPath: pm.expect(pm.response.json()).to.have.jsonPath('$.data.id'). Cypress, Playwright, and most test runners have similar integrations.
  2. kubectl output. kubectl get pods -o jsonpath='{.items[*].metadata.name}' is one of the most useful tricks for shell scripting against Kubernetes.
  3. Configuration extraction. Pulling specific values out of a config file or API response in a CI script without writing custom parsing code.
  4. JMeter / Gatling assertions. Load testing tools use JSONPath to assert on response bodies.
  5. JSONata, jq, and friends. Other JSON query languages exist (jq is more powerful but has its own syntax; JSONata is a superset of JSONPath with computation). JSONPath is the lowest common denominator.

JSONPath vs jq vs JMESPath

  • JSONPath, small, declarative, widely embedded. Read-only. The right choice when something else has chosen it for you (kubectl, Postman).
  • jq, a full functional language for JSON. Can transform, not just query. Steeper learning curve. The right choice for shell scripting and complex data wrangling.
  • JMESPath, different syntax (users[?active].email instead of $.users[?(@.active)].email), more compositional. The standard in AWS CLI. The right choice when AWS tooling has chosen it for you.

If you're picking from scratch for an application, jq is the most powerful, JSONPath the most embedded, JMESPath the most modern-feeling. There's no wrong answer.

Performance Notes

The recursive descent operator (..) walks every node in the document. On a 1 MB JSON file, this is microseconds; on a 50 MB file with deep nesting, it can take noticeable time. For large documents, prefer explicit paths or pre-filter with a coarser query before recursing.

Debugging Tips

When a JSONPath query doesn't match what you expect:

  1. Start with $ alone, confirm the document parses.
  2. Add path segments one at a time. Each step, the result should narrow. If a step returns nothing, that segment is wrong.
  3. Check filter syntax. @ is mandatory inside filters. Strings need quotes ('admin', not admin).
  4. Watch for null values. JSONPath skips null gracefully, but $.user.name against {"user": null} returns nothing rather than throwing. If you expected a null, that's why.

Privacy: Test Production Data Safely

The tester runs entirely in your browser. The JSON you paste, the queries you run, and the results all stay local. Open DevTools β†’ Network, no requests are made during a query. You can debug a production API response payload with sensitive data and trust it stays on your machine.

You Might Also Need