A JSON Path tester lets you write and test JSONPath expressions against live JSON data — seeing the matched results instantly. JSONPath is like XPath for JSON: it lets you query deeply nested structures, filter arrays, and extract specific fields without writing code.
This guide covers JSONPath syntax, common query patterns, how to use it for API debugging, and practical examples you can copy directly into your projects.
Test Your JSONPath Expressions
Paste JSON data, write JSONPath queries, and see matched results instantly.
What Is JSONPath?
JSONPath is a query language for JSON, similar to XPath for XML. It uses dot-notation or bracket-notation to traverse JSON structures:
Basic Syntax
| Expression | Meaning | Example |
|---|---|---|
| $ | Root object | $ (entire JSON) |
| $.property | Child property | $.name → "Raj" |
| $.parent.child | Nested property | $.address.city |
| $.array[0] | Array index | $.users[0] |
| $.array[*] | All array elements | $.users[*].name |
| $..property | Recursive search (deep scan) | $..email (all emails) |
| $.array[?(@.age>25)] | Filter expression | Users older than 25 |
JSONPath is used in API testing tools (Postman, REST Assured), config files (Kubernetes), and BI tools. jq is a CLI tool for shell scripting. Both query JSON, but JSONPath is more portable across platforms.
Common JSONPath Patterns
Here are the most-used JSONPath expressions with examples:
Sample JSON
{
"store": {
"books": [
{ "title": "Clean Code", "price": 450, "category": "tech" },
{ "title": "Atomic Habits", "price": 350, "category": "self-help" },
{ "title": "System Design", "price": 600, "category": "tech" }
],
"location": "Mumbai"
}
}
Query Examples
| Query | Expression | Result |
|---|---|---|
| All book titles | $.store.books[*].title | ["Clean Code", "Atomic Habits", "System Design"] |
| First book | $.store.books[0] | { "title": "Clean Code", ... } |
| Last book | $.store.books[-1:] | { "title": "System Design", ... } |
| Books under Rs.500 | $.store.books[?(@.price<500)] | [Clean Code, Atomic Habits] |
| Tech books only | $.store.books[?(@.category=="tech")] | [Clean Code, System Design] |
| All prices | $..price | [450, 350, 600] |
| Store location | $.store.location | "Mumbai" |
Filter Expressions: Querying with Conditions
Filter expressions are the most powerful JSONPath feature. They let you query arrays with conditions:
Filter Syntax
$.array[?(@.field operator value)]
Supported Operators
| Operator | Meaning | Example |
|---|---|---|
| == | Equals | $.users[?(@.role=="admin")] |
| != | Not equals | $.users[?(@.status!="inactive")] |
| > | Greater than | $.products[?(@.price>1000)] |
| < | Less than | $.orders[?(@.total<500)] |
| >= | Greater or equal | $.items[?(@.qty>=10)] |
| =~ | Regex match | $.users[?(@.email=~/gmail/)] |
| in | In list | $.items[?(@.color in ["red","blue"])] |
Combine filters with && (and) or || (or): $.products[?(@.price>100 && @.category=="electronics")] returns electronic products over Rs.100.
Using JSONPath for API Debugging
JSONPath is invaluable when working with complex API responses:
- Paste the API response — Copy a JSON response from Postman, curl, or browser DevTools
- Write a query — Use JSONPath to drill into the specific data you need
- Verify the structure — Check that nested fields exist and contain expected types
- Build your code — Once you have the right JSONPath, translate it to your language's JSON access pattern
JSONPath to Code Translation
// JSONPath: $.data.users[?(@.active==true)].email
// JavaScript
data.users.filter(u => u.active === true).map(u => u.email)
// Python
[u["email"] for u in data["users"] if u["active"] == True]
Postman uses JSONPath in test assertions. Write your query in this tester first, then copy it to your Postman test script: pm.expect(jsonData.store.books[0].title).to.eql("Clean Code");
Where JSONPath Is Used
JSONPath appears in many tools and platforms beyond just testing:
| Tool/Platform | How JSONPath Is Used |
|---|---|
| Postman | Test assertions and variable extraction |
| REST Assured (Java) | API test assertions |
| Kubernetes | kubectl get -o jsonpath='...' |
| AWS Step Functions | Input/output processing |
| Jayway JsonPath (Java) | Server-side JSON querying |
| jsonpath-ng (Python) | Python JSON querying |
Learning JSONPath once helps across all these tools. The tester lets you experiment with expressions before using them in code or config files.
Tips for Writing Better JSONPath Queries
- Start from the root — Always begin with $. It makes queries unambiguous and portable.
- Use deep scan ($..) carefully — It searches the entire tree and can be slow on large JSON. Prefer explicit paths when you know the structure.
- Test with real data — Sample data may not cover all edge cases. Test with actual API responses that include nulls, empty arrays, and missing fields.
- Handle missing fields — If a field might not exist, your code should handle undefined/null results gracefully.
- Use bracket notation for special characters — Properties with dots, spaces, or hyphens need bracket notation: $["my-property"] instead of $.my-property.
Different libraries implement JSONPath slightly differently (especially for filters and slices). Always test your expressions in the same library your project uses.
How to Use the Tool (Step by Step)
- 1
Paste Your JSON
Paste the JSON data you want to query into the JSON input area.
- 2
Write a JSONPath Expression
Enter a JSONPath expression like $.store.books[*].title to query specific data.
- 3
View Results Instantly
The tester shows matched results in real-time as you type the expression.
- 4
Refine and Copy
Adjust your expression until it returns exactly the data you need. Copy the expression for use in your code.
Frequently Asked Questions
What is JSONPath?+−
JSONPath is a query language for JSON data, similar to XPath for XML. It lets you extract specific values from nested JSON structures using dot-notation expressions like $.users[0].name.
What does $ mean in JSONPath?+−
$ represents the root of the JSON document. All JSONPath expressions start with $. For example, $.name accesses the "name" property at the root level.
How do I query all elements in an array?+−
Use [*] wildcard. $.users[*].name returns the name of every user in the users array. $.users[*] returns all user objects.
How do I filter an array by condition?+−
Use filter expressions: $.users[?(@.age>25)] returns users older than 25. The @ symbol refers to the current element being evaluated.
What is the difference between $.property and $..property?+−
$.property accesses a direct child. $..property (deep scan) searches the entire JSON tree recursively. Deep scan finds the property at any nesting level.
Can I use JSONPath in Postman?+−
Yes. Postman uses JSONPath for test assertions and variable extraction. Test your expression here first, then use it in Postman test scripts.
Does JSONPath work in all programming languages?+−
JSONPath libraries exist for JavaScript, Python, Java, C#, Go, and more. Syntax is mostly consistent, but filter expression support varies between implementations.
Is this JSON Path tester free and private?+−
Yes. All query evaluation happens in your browser. No JSON data is sent to any server.
Test Your JSONPath Expressions
Paste JSON data, write JSONPath queries, and see matched results instantly.
Open JSON Path Tester ->Related Guides
JSON Formatter Guide
A complete developer reference for JSON syntax, common errors, formatting options, and how to validate JSON in any language or tool.
JSON Tree Viewer Guide
View JSON as an expandable tree, search keys/values, copy paths, and navigate deeply nested API responses and config files.
JSON Schema Generator — Complete Guide
Generate, validate and understand JSON Schema for APIs, TypeScript and OpenAPI