JSONPath Tester

Test and evaluate JSONPath expressions against your JSON data

What Is JSONPath?

JSONPath is a query language for extracting and selecting data from JSON documents. Originally proposed by Stefan Goessner in 2007 as the JSON counterpart to XPath, JSONPath is now formalized as RFC 9535. It provides a concise syntax for navigating nested JSON structures, filtering arrays, and selecting multiple values in a single expression.

JSONPath expressions always start with $ (the root element) and use a combination of dot notation, bracket notation, wildcards, and filters to drill into the data. For example, given a JSON document describing a bookstore, $.store.book[0].title returns the title of the first book, and $.store.book[?(@.price < 10)] returns all books under $10.

You’ll encounter JSONPath in REST API testing (Postman, REST Assured), Kubernetes (kubectl JSONPath output), configuration management, data pipelines, and test assertions. It’s the standard way to pinpoint values inside JSON without writing custom parsing code.

JSONPath Syntax Reference

Here’s the complete syntax this tool supports:

ExpressionDescriptionExample
$Root element$ — the entire document
.propertyDot-notation child$.store — the store object
['property']Bracket-notation child$['store'] — same as above
[n]Array index (0-based)$.book[0] — first book
[-n]Negative index (from end)$.book[-1] — last book
[start:end]Array slice$.book[0:2] — first two books
[start:end:step]Slice with step$.book[::2] — every other book
.* or [*]Wildcard (all children)$.book[*].title — all titles
..propertyRecursive descent$..price — every price at any depth
..*Recursive wildcard$..* — every value in the tree
[?(@.expr)]Filter expression$.book[?(@.price < 10)] — cheap books
[a,b]Union (multiple indices)$.book[0,2] — first and third books

How to Use This JSONPath Tester

  1. Paste your JSON document into the input area on the left.
  2. Type your JSONPath expression in the expression field (e.g., $.store.book[*].author).
  3. Click Evaluate or press Ctrl+Enter to run the query.
  4. Review the results — matched values are displayed as formatted JSON, with their full paths shown for reference.
  5. Copy the results with the Copy button or Ctrl+Shift+C.

The tool validates your JSON first. If the JSON is malformed, you’ll see a parse error with the position of the problem. If the JSONPath expression is invalid, you’ll see a syntax error explaining what went wrong.

Common JSONPath Expressions

These are the expressions developers use most often:

Select a single property: $.config.database.host — navigates directly to a nested value. This is the most basic and most common pattern.

Get all items in an array: $.users[*] — the wildcard [*] selects every element. Equivalent to iterating the array.

Find all values by key name: $..email — recursive descent finds every property named “email” regardless of depth. Invaluable when you know the key name but not where it lives in the structure.

Filter by value: $.products[?(@.inStock == true)] — returns only products where inStock is true. Filter expressions are the most powerful part of JSONPath.

Slice an array: $.results[0:5] — returns the first 5 elements. Useful for pagination or limiting output.

Combine selections: $.book[0,1,3] — returns the first, second, and fourth books. Union syntax selects specific indices.

Negative indexing: $.logs[-1] — returns the last element. $.logs[-3:] returns the last three.

JSONPath vs XPath vs jq

FeatureJSONPathXPathjq
Data formatJSONXMLJSON
Root symbol$/.
Recursive descent..//.. / recurse
Filters[?(@.x > 5)][price > 5]select(.x > 5)
Wildcards**.[]
OutputSelected valuesNode setsTransformed JSON
TransformationNo (read-only)Limited (XSLT)Full (map, reduce)
StandardizedRFC 9535 (2024)W3C (1999)No formal spec

JSONPath is the right tool when you need to select values from JSON in a portable, standardized way — in API tests, Kubernetes, or CI/CD pipelines. Use jq when you need to transform the data (reshape, aggregate, construct new objects). Use XPath when working with XML documents.

Where JSONPath Is Used

  • API testing: Postman, REST Assured, Karate, and other testing frameworks use JSONPath to assert response values. expect(response).to.have.jsonPath('$.data.id', 42).
  • Kubernetes: kubectl get pods -o jsonpath='{.items[*].metadata.name}' extracts pod names from the API response.
  • Data pipelines: Apache NiFi, AWS Step Functions, and Azure Logic Apps use JSONPath to extract fields from JSON payloads.
  • Configuration: Spring Boot, Jayway, and other frameworks use JSONPath for dynamic configuration and property access.
  • Databases: PostgreSQL’s jsonb_path_query and MySQL’s JSON_EXTRACT support JSONPath-like syntax for querying JSON columns.

Use this tool to prototype and debug your JSONPath expressions before embedding them in code, test suites, or pipeline configurations.

Frequently Asked Questions

What is JSONPath?

JSONPath is a query language for JSON, similar to XPath for XML. It lets you extract specific values from a JSON document using path expressions like $.store.book[0].title to get the title of the first book. JSONPath was proposed by Stefan Goessner in 2007 and is now formalized as RFC 9535.

How do I test a JSONPath expression online?

Paste your JSON into the input area and type your JSONPath expression in the expression field above the buttons. Click Evaluate or press Ctrl+Enter to see the matching results. The tool shows both the matched values and their paths within the JSON document, making it easy to verify your expression is correct.

What does the $ symbol mean in JSONPath?

The dollar sign ($) represents the root element of the JSON document. Every JSONPath expression starts with $. For example, $.name selects the 'name' property of the root object, and $[0] selects the first element of a root array.

How do I select nested properties in JSONPath?

Use dot notation ($.parent.child) or bracket notation ($['parent']['child']) to navigate nested objects. For deeply nested properties where you don't know the exact path, use the recursive descent operator (..) — for example, $..price finds every property named 'price' at any depth in the document.

What is the difference between JSONPath and jq?

JSONPath is a query language for selecting values from JSON, commonly used in REST APIs, testing frameworks, and configuration tools. jq is a command-line JSON processor with its own language for filtering, transforming, and constructing JSON. JSONPath focuses on selection (read-only), while jq supports full transformation (map, reduce, conditionals). Use JSONPath when you need a portable query syntax; use jq for data transformation pipelines.

Is my JSON data safe in this JSONPath tester?

Yes. All JSONPath evaluation runs entirely in your browser using JavaScript. No data is sent to any server. You can verify this by checking your browser's Network tab — there are zero outbound requests when you evaluate an expression. Your data never leaves your machine.

What JSONPath filter expressions are supported?

This tool supports filter expressions using [?(@.property op value)] syntax. Supported operators include == (equals), != (not equals), > (greater than), < (less than), >= (greater or equal), and <= (less or equal). You can filter by string, number, boolean, or null values. For example, $.store.book[?(@.price < 10)] selects all books cheaper than 10.