DevKits

JSONPath Tester

Test JSONPath expressions against sample JSON online. Get instant, highlighted results for queries like $.store.book[*].author.

Last updated:

Paste JSON and a JSONPath expression above (like $.store.book[*].author) to see matching values instantly, highlighted in the source. Everything runs in your browser.

What is JSONPath Tester?

JSONPath is a query language for JSON, analogous to what XPath is for XML. It lets you select values deep inside a document with a compact expression — pull every author from a nested catalog, grab the third item of an array, or recursively find every field named id. This tester evaluates expressions live so you can build and debug a path before wiring it into Kubernetes, Postman, or your code.

How to test a JSONPath expression

  1. 1Paste your JSON document into the source pane.
  2. 2Type a JSONPath expression, e.g. $.items[*].name.
  3. 3Matching values appear instantly, and the matched nodes are highlighted in the source.
  4. 4Refine the expression until it selects exactly the values you need.

Use Cases

Build kubectl / Kubernetes queries

kubectl uses JSONPath in -o jsonpath=. Test your expression here before running it against a cluster.

Extract fields in Postman tests

Postman and many API tools use JSONPath to assert on response bodies. Validate the path first.

Pull nested values in code

Prototype the exact selector you'll pass to a JSONPath library in Node, Python, or Java.

Code Examples

Common expressions

$.store.book[*].author   // all authors
$..price                 // every price, at any depth
$.items[0]               // first item
$['a']['b']              // bracket notation

Key Concepts

Root ($) and recursive descent (..)
$ is the document root. `..` searches at any depth, so $..id finds every id field no matter how deeply nested.
Wildcards and indices
[*] selects all elements/members; [0] selects by index; [0,2] selects multiple; negative indices are supported by some engines.
JSONPath vs JMESPath vs jq
JSONPath is the most widely embedded (Kubernetes, Postman). JMESPath adds functions and pipes. jq is a full DSL with control flow — the most powerful of the three.

Tips & Best Practices

  • Dot notation ($.a.b) and bracket notation ($['a']['b']) are equivalent; use brackets for keys with spaces or special characters.
  • Implementations differ — filter expressions [?()] and some functions aren't supported everywhere. Test against your target engine.
  • Use recursive descent ($..key) sparingly on huge documents; it scans every node.
  • kubectl's JSONPath is a limited dialect — verify complex expressions actually work with kubectl, not just here.

Frequently Asked Questions

Which JSONPath syntax is supported?

The core JSONPath spec: dot notation ($.a.b), bracket notation ($['a']), wildcards ($.a[*]), array indices, and recursive descent ($..key). Filter expressions ([?()]) are not yet supported.

How is JSONPath different from JMESPath or JQ?

JSONPath is the simplest and most widely supported (used in Kubernetes, Postman, many APIs). JMESPath adds pipes and functions. jq is a full DSL with control flow — more powerful but not JavaScript-native.

Related Tools