How to test a JSONPath expression
- Paste your JSON into the editor on the left.
- Type an expression in the Query tab, for example $.users[*].name, or click one of the examples.
- Read the matches with their paths, and press Copy values to copy all matched values as a JSON array.
Filters and comparisons
Filter expressions compare values of the current item, for example $.books[?(@.price > 10 && @.inStock == true)].title. Strings must be quoted, and a filter on a missing key simply does not match. Filters are evaluated by a built-in parser, not by running JavaScript.
Using the paths in code
Each match is shown with a JavaScript-style accessor such as $.users[0].name. In the Tree tab you can also hover any row and copy its path, which is the quickest way to build an expression for a value you can see.
What JSONPath is
JSONPath is a query language for JSON, modelled on XPath for XML. An expression starts at the root, written $, and walks down through keys and array indexes to select one or many values. It was described informally in 2007 and standardised as RFC 9535 in 2024, but many implementations predate the standard and differ in details, so an expression that works in one library can behave differently in another.
Syntax cheat sheet
$ is the root. .key or ['key'] selects a child, and bracket notation is needed for keys with spaces or dots. [0] selects an array item. A slice with a negative start such as [-1:] selects the last item (and [-2:] the last two); plain [-1] is not supported by every implementation, and it returns nothing here. [*] or .* selects every child. .. is recursive descent: $..price finds every key named price at any depth. [0:3] is a slice, [0,2] picks several indexes, and ['a','b'] picks several keys.
A filter selects the items that satisfy a condition: [?(@.price < 10)], where @ is the item being tested. Conditions can combine comparisons with && and ||, and can test whether a key exists with [?(@.isbn)].
$.store.book[*].author all authors
$.store.book[?(@.price < 10)].title titles of cheap books
$..price every price, at any depth
$.store.book[0,2] the first and third book
$.store.book[-1:] the last book (a slice)
$..book[?(@.isbn)] books that have an isbnWorked example
The bookstore sample loaded on this page has four books. The expression $.store.book[?(@.price < 10)].title returns the titles of the three books under ten, and adding && @.inStock == true narrows that to the ones you can buy. Try changing the number, then switch to $..author to see how recursive descent collects values from different levels.
Results are listed in the order the engine finds them, normally document order, each with its full path. Use Copy values to copy all matched values as a JSON array.
Common mistakes
Strings in filters must be quoted: [?(@.category == 'fiction')]. A filter on a key that is missing from an item simply does not match, rather than raising an error. Recursive descent over a large document can return a very large number of matches; narrow it with a more specific path. If a result is empty, check key spelling and case first, then whether the value sits one level deeper than you expected, which is where the tree view and its copy path button help.
Filter expressions here are evaluated by a built-in parser, not by running JavaScript, which is safer but means that arbitrary JavaScript inside a filter is not supported.
JSONPath compared with jq and JMESPath
jq is a command-line language that can filter, transform and reshape JSON, with its own syntax and functions; it is a good choice for scripts. JMESPath is a different query language with a formal specification, used for example by the AWS CLI for its --query option. kubectl accepts JSONPath templates for its -o jsonpath output, with a few differences from the generic syntax. When you copy an expression into a tool, check that tool's documentation for the dialect it supports.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data format that is easy for people to read and for machines to parse. It is the de facto standard for web APIs, configuration files and data exchange between services. A JSON document is built from just six value types: objects, arrays, strings, numbers, booleans and null.
{
"name": "Ada",
"age": 36,
"admin": true,
"skills": ["math", "code"],
"address": { "city": "London" },
"manager": null
}JSON is stricter than JavaScript object literals: keys and strings must use double quotes, trailing commas are not allowed and comments are not part of the specification (RFC 8259).
Why format JSON?
APIs usually return minified JSON on a single line, which is efficient for machines but unreadable for people. Formatting (also called pretty printing or beautifying) adds consistent indentation and line breaks so that you can scan the structure, spot mistakes and review changes. Minifying does the opposite and strips whitespace to reduce size.
Frequently asked questions
Which JSONPath implementation is used?
The tool uses the widely used jsonpath-plus library in its safe mode. It supports the common JSONPath syntax; implementations differ in edge cases, so check unusual expressions against your own library.
Does it run my expression as JavaScript?
No. Filter expressions are parsed by a built-in evaluator, so arbitrary code cannot run.
Is my JSON uploaded to a server?
No. Parsing, validation, formatting, diffing and code generation all run inside your browser, using a Web Worker. Your data is never sent to any server, which makes the tool safe for API responses, configuration files and other sensitive payloads.
Does it work offline?
Yes, after the first visit. The editor and tools are stored in your browser, so you can use them without a connection. Only the TypeScript, CSS and HTML language workers used for extra highlighting in the Code tab are downloaded the first time you use them.
How large a JSON file can I open?
Files of 20 MB and more work. Parsing happens off the main thread and the tree view is virtualized, so only the rows you can see are rendered. The editor switches to a lighter mode for very large documents.
What is the difference between formatting and minifying JSON?
Formatting (pretty printing) adds line breaks and indentation so people can read the data. Minifying removes all optional whitespace to make the payload as small as possible for network transfer or storage. Both produce identical data.
More JSON tools
- JSON Viewer Online
- JSON Validator
- JSON to TypeScript
- JSON to Go Struct
- JSON to Python (Pydantic)
- JSON Diff
- JSON Minifier
- JSON Pretty Print
- JSON to YAML
- JSON to CSV
- JSON to XML
- Large JSON Viewer
- JSON Tree Viewer
- JSON File Viewer
- JSON Sorter
- JSON to Zod
- JSON to Rust
- JSON to Java
- JSON Schema Validator
- JSON to JSON Schema
- JSON Path Finder