JSON Input

Query Results

What Is JSONPath?

JSONPath is a query language for JSON, analogous to XPath for XML. It uses a concise path expression syntax to address parts of a JSON document. The RFC 9535 standardizes the JSONPath specification. A JSONPath expression always starts with $ (the root element) and uses dot notation (.key), bracket notation (['key'] or [n]), wildcards ([*]), and recursive descent (..) to traverse the document.

Queries run in your browser on the jsonpath-plus library, with its safe evaluator (filter expressions are parsed, never passed to eval). That covers root ($), child (.key and ['key']), array index ([n], [-1]), slices ([0:2]), unions ([0,1]), wildcards ([*]), recursive descent (..) and filters ([?(@.price < 10)], [?(@.inStock && @.price >= 30)]). Results always come back as a JSON array. If you want a single-value pointer instead of a path query, see JSON Pointer (RFC 6901), which JSONPath complements rather than replaces.

How to Query JSON with JSONPath

Follow these steps to extract data from your JSON using a JSONPath expression.

1

Paste your JSON

Paste your JSON document into the input panel, or click Sample to load a bookstore example. The JSON must be valid before a query can be executed.

2

Enter a JSONPath expression

Type your JSONPath expression in the query field. With the sample loaded, try: $.store.books[*].author for every author; $..price for every price at any depth; $.store.books[?(@.price < 40)].title for books under $40; $.store.books[?(@.inStock)].title for books in stock. You can also cross-check an expression in the JSONPath playground.

3

Run and copy results

Click Run Query or press Enter. The matching values appear as a JSON array in the results panel, with a count next to the heading. Click Copy Results to copy the output.

Common Use Cases

API Response Filtering

Extract only the fields you need from a large API response without writing custom code. Use JSONPath to pull out specific nested values, arrays, or filtered subsets in one expression.

Data Exploration

When exploring an unfamiliar JSON dataset, use recursive descent ($..) to discover all occurrences of a field name at any depth — useful for understanding deeply nested data structures.

Test Assertion Generation

Generate precise test assertions by querying the exact values you want to assert in your automated tests. Copy the JSONPath expression into your test framework (Jest, Cypress, etc.) for readable, maintainable assertions.

Configuration Value Extraction

Extract specific values from large JSON configuration files — feature flags, environment-specific settings, or service endpoints — without parsing the entire document in code.

Frequently Asked Questions

What JSONPath operators are supported?

Root $, child .key and ['key'], array index [n] (negative counts from the end), slices [start:end], unions [0,1], wildcard [*], recursive descent .., and filters [?(...)] with ==, !=, <, >, <=, >=, &&, ||, nested fields like @.dims.width, and existence checks like [?(@.inStock)].

How is JSONPath different from SQL?

JSONPath is a path expression language for navigating hierarchical JSON data — it is not a relational query language. It does not support JOINs, GROUP BY, or aggregation. For complex transformations, consider using jq instead.

Does the evaluator support all JSONPath features?

Most of what people use day to day, yes, because it runs on jsonpath-plus. The main difference from RFC 9535 is the filter language: this tool uses the classic Goessner-style JavaScript-like expressions (@.price >= 30 && @.inStock), not the RFC's function extensions such as length() or match(). Arbitrary JavaScript (function calls, constructor tricks) is rejected.

Is my data sent to a server?

No. All query evaluation happens entirely in your browser. No data is transmitted anywhere.

What is the result format?

Results are always a JSON array, even when only one value matches. An empty array ([]) means nothing matched. Very large integers, such as a 19-digit order ID, are printed with every digit intact.

Related Tools

Explore more JSON querying, filtering, and validation tools.