JSON Path Tester
Test JSONPath expressions online. Extract, filter, and query JSON data instantly with real-time evaluation.
🔗 Related JSON Tools
What is JSONPath?
JSONPath is a query language for JSON (JavaScript Object Notation) that allows you to extract specific data from JSON documents using path expressions. Similar to how XPath works for XML, JSONPath provides a simple and powerful way to navigate and filter JSON data structures.
JSONPath expressions start with $ representing the root element, followed by property
names separated by dots (.) and array indices in brackets ([]). For example,
$.store.book[0].title extracts the title of the first book in a store object.
Why Use a JSON Path Tester?
Unlike basic JSONPath evaluators, our tool provides instant syntax highlighting, pre-built expression examples, and human-readable error messages. You get real-time results as you type — no page refreshes, no account required, and complete privacy since all processing happens in your browser.
- Debug API Responses: Quickly extract and validate specific data from complex JSON API responses
- Test Extraction Logic: Validate your JSONPath expressions before using them in production code
- Learn JSONPath Syntax: Experiment with different expressions using the built-in examples
- QA & Automation Testing: Test JSONPath queries used in automation frameworks like Playwright, Cypress, or Postman
- Data Transformation: Extract specific fields from large JSON datasets
- API Development: Validate that your API returns expected data structures
JSONPath Syntax Explained
| Expression | Description | Example |
|---|---|---|
$ |
Root object/element | $ → entire JSON |
. |
Child operator | $.store → store object |
.. |
Recursive descent | $..author → all authors |
* |
Wildcard (all elements) | $.store.* → all children |
[n] |
Array index | $.books[0] → first book |
[n,m] |
Multiple indices | $.books[0,2] → 1st and 3rd |
[start:end] |
Array slice | $.books[:2] → first two |
[?()] |
Filter expression | [?(@.price < 10)] |
@ |
Current element (in filter) | @.price in filter |
Common JSONPath Examples
1. Extract All Values of a Key
$.store.book[*].author
Returns: ["Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"]
2. Filter by Condition
$.store.book[?(@.price < 10)]
Returns all books where price is less than 10.
3. Recursive Search
$..price
Finds all "price" properties at any level in the JSON structure.
4. Array Slicing
$.store.book[-2:]
Returns the last two books in the array.
5. Filter with String Match
$.store.book[?(@.category=="fiction")]
Returns all books in the "fiction" category.
JSONPath vs XPath
| Feature | JSONPath | XPath |
|---|---|---|
| Data Format | JSON | XML |
| Root Symbol | $ |
/ |
| Child Selector | . or [] |
/ |
| Recursive Descent | .. |
// |
| Current Node | @ |
. |
| Complexity | Simpler | More powerful |
JSONPath is generally simpler and more intuitive for JSON data, while XPath offers more advanced features for XML documents. If you're working with APIs and JSON data, JSONPath is the natural choice.
JSONPath Use Cases in APIs & Automation
- Postman Tests: Use JSONPath in Postman test scripts to validate API responses
- REST Assured: Extract values from API responses in Java-based API testing
- Cypress/Playwright: Parse and validate JSON in end-to-end tests
- JMeter: Extract data from JSON responses using JSON Path Extractor
- AWS Step Functions: Use JSONPath for state machine data manipulation
- Kubernetes: JSONPath queries in kubectl for custom output
- Data Pipelines: Extract and transform JSON data in ETL processes
Frequently Asked Questions
What is JSONPath?
$.store.book[0].title.
How do I use JSONPath to extract data?
$ symbol to represent the root object, then chain property names with
dots (.) and array indices with brackets ([]). For example,
$.users[0].name extracts the name of the first user.
Can I filter JSON arrays with JSONPath?
$.books[?(@.price < 10)] to find all books
with price less than 10, or $.users[?(@.active==true)] to find active users.
What's the difference between . and .. in JSONPath?
.) accesses direct children, while double dot (..)
performs a recursive descent, searching at all levels. For example, $..author
finds all "author" properties anywhere in the JSON.