JSONPath Tester

Query and extract data from JSON using JSONPath expressions — live results as you type.

JSONPath
JSON Input
Results
Enter a JSONPath expression above to see matched values here.
Tree View Click any node to copy its JSONPath
Paste valid JSON above to see the tree view.

JSONPath Quick Reference

$
Root object
.key
Child property
..key
Recursive descent — find all
[*]
Wildcard — all elements
[0]
Array index (0-based)
[-1]
Last array element
[0:3]
Array slice (start:end)
[0:5:2]
Slice with step
[?(@.price<10)]
Filter expression
[?(@.isbn)]
Existence check
.length
Array / string length
.*
All children of current node

What is JSONPath?

JSONPath is a query language for JSON data, originally proposed by Stefan Goessner as the JSON equivalent of XPath for XML. It lets you navigate deeply nested JSON structures and extract exactly the values you need using concise path expressions. JSONPath is widely supported in API testing tools like Postman, REST-assured, and Karate, as well as in programming languages through libraries like Jayway JSONPath (Java), jsonpath-ng (Python), and jsonpath-plus (JavaScript).

JSONPath vs XPath vs jq

Feature JSONPath XPath jq
Data format JSON XML JSON
Root $ / .
Child access .key or ['key'] /key .key
Recursive ..key //key .. | .key?
Filters [?(@.x>1)] [x>1] select(.x>1)

Common JSONPath Use Cases

  • API response extraction: Pull specific fields from large REST API responses for testing or transformation.
  • Configuration lookup: Navigate deep config files to find specific settings without writing custom parsing code.
  • Data transformation: Select subsets of JSON data for ETL pipelines, reporting, or feeding into other tools.
  • Automated testing: Assert specific values in API responses using JSONPath in test frameworks like Postman, REST-assured, or Cypress.
  • Log analysis: Extract structured data from JSON-formatted application logs for debugging and monitoring.

JSONPath Syntax Guide

Basic Navigation

Every JSONPath expression starts with $ representing the root. Use dot notation ($.store.name) or bracket notation ($['store']['name']) to traverse objects. For arrays, use zero-based indices: $.items[0] gets the first element, $.items[-1] gets the last.

Wildcards and Recursive Descent

The wildcard [*] selects all elements in an array or all values of an object. The recursive descent operator .. searches the entire tree: $..name finds every name property at any depth. Combine them for powerful queries like $..* to list every value in the document.

Filter Expressions

Filter expressions use [?()] syntax with @ representing the current element. Supported operators include ==, !=, <, >, <=, >=. You can check existence ([?(@.isbn)]) or compare values ([?(@.price<10)]). String comparisons should use quotes: [?(@.color=='red')].

Related Tools

Frequently Asked Questions

What is JSONPath?

JSONPath is a query language for JSON, similar to XPath for XML. It allows you to navigate and extract specific values from a JSON document using path expressions like $.store.book[0].title or $..author to find all authors recursively.

How do I use a JSONPath tester online?

Paste your JSON data into the input field, type a JSONPath expression like $.store.book[*].title in the query box, and the tool instantly highlights and displays the matched values. You can also click nodes in the tree view to auto-generate the path.

What JSONPath syntax is supported?

Common JSONPath syntax includes: $ (root), .key (child), ..key (recursive descent), [*] (wildcard), [0] (array index), [0:3] (array slice), and [?(@.price<10)] (filter expressions). These cover the vast majority of real-world querying needs.

What is the difference between JSONPath and jq?

JSONPath and jq both query JSON data but have different syntax. JSONPath uses dot notation like $.store.book[0], while jq uses pipe-based syntax like .store.book[0]. JSONPath is commonly used in REST APIs and testing tools, while jq is a command-line tool popular in shell scripts.

Can JSONPath filter JSON arrays?

Yes. JSONPath supports filter expressions with the syntax [?(@.field operator value)]. For example, $.store.book[?(@.price<10)] returns all books cheaper than 10, and $.users[?(@.active==true)] returns only active users.