Paste your JSON on the left, write a JSONPath expression, and see matching results instantly on the right. Great for exploring API responses, extracting nested values, and testing queries before using them in code.
JSONPath uses $ to represent the root of the document. Here are the most useful patterns:
| Expression | Meaning |
|---|---|
$ | Root element |
$.name | Field name on the root object |
$.users[0] | First element of users array |
$.users[*] | All elements of users array |
$.users[*].email | email field from every user |
$..name | All name fields at any depth (recursive) |
$.users[?(@.active == true)] | Filter: users where active is true |
$.items[?(@.price < 10)] | Filter: items where price is less than 10 |
Dot notation vs bracket notation — both forms are equivalent:
$.user.name is the same as $['user']['name']$['first name']Array slicing — Python-style slice syntax selects a range of elements:
$.items[0:3] — first three items (indices 0, 1, 2)$.items[-1:] — last item$.items[::2] — every second itemUnion — select multiple fields or indices in one expression:
$.user['name','email'] — both name and email fields$.items[0,2,4] — items at index 0, 2, and 4Filter expressions — use @ to refer to the current node:
$.users[?(@.age >= 18)] — users who are adults$.products[?(@.stock > 0 && @.price < 50)] — in-stock items under $50$.users[?(@.role == 'admin')] — users with admin roleRecursive descent — $.. searches all depths:
$..id — every id field anywhere in the document$..price — useful for finding all prices in a nested product cataloguePostman test scripts use JSONPath to assert values in API responses:
pm.expect(pm.response.json().data.users[0].name).to.equal("Alice");
AWS Step Functions use JSONPath for InputPath, OutputPath, and ResultPath — the mechanism that extracts and routes data between states in a state machine.
kubectl supports JSONPath via the -o jsonpath flag for formatting command output:
kubectl get pods -o jsonpath='{.items[*].metadata.name}'
Splunk's spath command extracts fields from JSON events using JSONPath-like expressions. Spring Boot's MockMvc and REST Assured both use JSONPath for response body assertions in integration tests.
JSONPath and jq solve similar problems but in different contexts.
| Feature | JSONPath | jq |
|---|---|---|
| Primary use | Embedded in tools (Postman, AWS, K8s) | Command-line JSON processing |
| Syntax | $.users[?(@.active)] | `.users[] |
| Output transformation | Read-only extraction | Full transformation (map, reduce, format) |
| Installation | None — built into many tools | Requires installation |
| Learning curve | Low | Medium |
JSONPath is the right choice when writing expressions inside another tool — Postman tests, AWS state machines, Kubernetes output flags, or Spring test assertions. jq is the right choice on the command line when you need to transform or reshape data, not just extract a value from it.
JSONPath is a query language for JSON, similar to XPath for XML. It lets you extract specific values from a JSON document using a path expression. It is widely used in tools like Postman, AWS Step Functions, and Kubernetes.
The $ symbol represents the root of the JSON document. All JSONPath expressions start with $. For example, $.name selects the name field at the top level.
Use the wildcard [*]. For example, $.users[*] returns all elements in the users array, and $.users[*].name returns the name field from every user.
Use a filter expression: $.users[?(@.active == true)]. The @ symbol refers to the current element being evaluated. You can use ==, !=, <, >, <=, >= operators.
The .. operator searches all levels of the document. For example, $..email returns every email field regardless of how deeply nested it is.
They are equivalent for simple keys — $.user.name and $['user']['name'] return the same result. Bracket notation is required when a key contains spaces, hyphens, or other special characters that dot notation cannot express.
No. JSONPath is a read-only query language — it can only select and extract values. To modify JSON you need to use code (JavaScript, Python, etc.) or a tool like jq.
No. JSONPath evaluation runs entirely in the browser tab. No data is transmitted.
More Tools