# JSONPath Tester - Query JSON Online

Test a JSONPath expression against your JSON and see matching values as you type. Use property paths, array indexes and wildcards to explore nested data in your browser.

### Document and path

JSONPath _$.items\[\*\].id_ JSON_{ "items": \[ { "id": 1, "name": "Ada" }, { "id": 2, "name": "Grace" } \] }_

Clear  Copy

Edit the source on the [JSON editor](https://www.toolcomb.com/json-editor). Compare two payloads on [JSON compare](https://www.toolcomb.com/json-compare).

### Matches

```
[
1,
2
]
```

## What Is a JSONPath Query Tool?

A **JSONPath query tool** answers a narrower question than a formatter or an editor: which nodes in this document match a path? JSONPath is closer to XPath than to a programming language. You start at the root `$`, walk into objects with dotted keys, and fan out over arrays with `[*]`. The default catalog on this page is two people. Path `$.items[*].id` reads every `id` under `items`. Because matches wrap as an array, the result is `[1, 2]` - not a rewritten document, not a jq program, and not a pretty-print of the original tree. Path `$.items[0].name` returns `["Ada"]`. That pair of checks is the whole point of shipping a query page instead of stretching the [JSON formatter](https://www.toolcomb.com/json-formatter).

JSONPath is useful when you need a small part of a larger response: product IDs from a catalog, error messages from a nested object, or URLs in a content export. Start with a property path such as `$.items`, then use `[*]` to select array entries or an index such as `[0]` for the first item. Recursive paths such as `$..id` can find matching properties at different depths. This tool does not support filter expressions and does not modify the source document.

Output is always a pretty-printed JSON array of matches. It is not a patch, not a JSON Pointer encoder, and not a schema. To change the original document, use the [JSON editor](https://www.toolcomb.com/json-editor). To check a contract, use the [JSON Schema validator](https://www.toolcomb.com/json-schema-validator). To see how two versions differ after you extracted a field, use [JSON compare](https://www.toolcomb.com/json-compare). Querying happens entirely in the browser after the page loads. The catalog and the path persist in `localStorage` for up to 30 days on this device. That is a draft, not a backup and not a server-side query engine.

## How to Query JSON with JSONPath - Step by Step

Results update as you edit the JSON or the path.

1. **Paste a JSON document** - Keep the default catalog or paste your own RFC 8259 JSON into the left panel. Invalid JSON is rejected before the path runs, with a line and column.
2. **Enter a JSONPath expression** - Type $.items[*].id to collect every item id, or $..name to find matching names at different depths. Filter expressions are not supported.
3. **Read the wrapped match array** - Matches appear on the right as pretty-printed JSON. A single hit and many hits both wrap as an array.
4. **Copy the result or restore the sample** - Click Copy to put the match array on the clipboard. Clear restores the catalog and the default path. Nothing is uploaded.

## JSONPath Worked Example - Before and After

The default sample is the gold-standard check for this tool. Keep it loaded, confirm the path, and you should see the same array every time. If you do not, the document failed to parse or the path was edited.

### Input - catalog JSON and path

```
{
"items": [
{ "id": 1, "name": "Ada" },
{ "id": 2, "name": "Grace" }
]
}

JSONPath: $.items[*].id
```

### Output - wrapped match array

```
[
1,
2
]
```

The source document is unchanged. The right panel is not a pretty-print of the catalog; it is the list of selected values. Extra checks on the same sample: `$.items[0].name` returns `["Ada"]`. `$.items[1]` returns the Grace object inside an array. `$..name` returns `["Ada","Grace"]`. `$.items[?(@.id==1)]` may fail because script filters are disabled - use `$.items[0]` instead.

## When You Need JSONPath - Real-World Use Cases

### Collecting primary keys from a paginated catalog

List endpoints often return `{ items: [{ id, name }, …] }` plus pagination metadata you do not care about in the moment. Path `$.items[*].id` is the same shape as this page's default. Paste the payload, copy the id array, and drop it into a test, a SQL `IN` clause, or a follow-up request. You are not writing a mapper and you are not installing jq for a thirty-second extraction.

### Pulling nested error strings out of gateway envelopes

API gateways wrap failures as `error.details[].message` or a similar nest. The HTTP client shows a 400; the useful sentence is four objects deep. Recursive descent `$..message` collects every message node when you do not remember the exact envelope. If the path is stable, a precise dotted path is clearer and faster than walking the whole tree.

### Harvesting SKUs or slugs before a spreadsheet import

Product dumps mix variants, images, and prices. You often need one column: SKU, handle, or slug. JSONPath returns that column as a JSON array you can paste into a sheet or feed to [JSON to CSV](https://www.toolcomb.com/json-to-csv) after you rebuild a tiny array of objects. Query first when flattening the whole tree would create dozens of unused columns.

### Checking which keys a generated infrastructure file actually contains

Cloud templates and policy documents are JSON with repetitive nested blocks. Before you grep a 4,000-line file, ask `$..Action` or `$.Resources.*.Type` (syntax depending on the document). You see the set of values without pretty-printing the entire template. If the file is not strict JSON, repair it first on [JSON repair](https://www.toolcomb.com/json-repair).

### Building compact test fixtures from a production-shaped sample

A captured response is useful until it is 80 KB of noise. Selecting `$.data.user.id` and a handful of sibling paths gives you the values your test actually asserts. Paste those into a fixture file. The query tool does not rewrite the capture; you decide what to keep. Edit the slim document on the [JSON editor](https://www.toolcomb.com/json-editor) afterward.

### Teaching JSONPath without installing Node or jq

Workshops stall when half the room fights package managers. This page loads, shows Ada and Grace, and makes `[*]` versus `[0]` visible in seconds. Students can break the path, see an empty array or an error, and recover with Clear. That is a better first hour than a slide of XPath analogies.

### Auditing which fields a client actually reads

Mobile and web clients often ignore half of a bloated payload. If you know the screens, you can write paths for the fields that appear in the UI and collect them from a real response. The leftover keys are candidates to drop from the API. Pair with [JSON compare](https://www.toolcomb.com/json-compare) when you want a full tree diff between two backend versions rather than a list of selected nodes.

### Extracting every URL nested under a CMS document

CMS JSON hides links in blocks, modules, and metadata. Recursive descent on a key such as `$..href` or `$..url` produces a checklist for link rot, CDN migration, or CSP review. It will also pick up unrelated keys named the same way - read the array before you treat it as a sitemap.

## JSONPath vs jq, JSON Pointer, GraphQL, and Sibling Tools

Use this table when you are choosing a selector rather than a formatter. Each column is a different job.

| Need | JSONPath (this page) | jq | JSON Pointer | JSON Schema | JSON editor |
| --- | --- | --- | --- | --- | --- |
| Collect every id in an array | ✓ $.items[*].id | ✓ .items[].id | One node only | Validates, does not select | Edit, does not query |
| Map, reduce, custom functions | No | ✓ | No | No | No |
| Address one node for a patch | Awkward | Possible | ✓ /items/0/id | No | Direct edit |
| Script filters such as ?(@.id==1) | Not supported in this tool | ✓ select() | No | const / enum | No |
| Ask a live API for a subset | No - local document only | No | No | No | No |
| Runs in this browser, no upload | ✓ | Local CLI | Library | [Schema page](https://www.toolcomb.com/json-schema-validator) | [Editor page](https://www.toolcomb.com/json-editor) |

GraphQL is missing from the grid on purpose: it is a server protocol, not a client-side walk of a document you already pasted. Regex over minified JSON is worse than any of the columns above. If you only need indentation, stay on the formatter.

## Common JSONPath Errors and Honest Limits

These are the failures this page will not hide, plus the jobs it will not pretend to do.

- **Invalid JSON first.** Trailing commas, comments, and unquoted keys fail in `parseJsonDocument` before JSONPath runs. Repair the draft or use the [JSON5 validator](https://www.toolcomb.com/json5-validator) if the dialect is intentional.
- **Empty path.** A blank JSONPath is rejected with an explicit prompt to enter something like `$.items[*].id`.
- **Filter expressions.** Paths such as `$.items[?(@.id==1)]` are not supported. Use an index or select the array items instead.
- **Syntax differences.** JSONPath tools do not all support the same expressions. If a path fails, try a property name, `[*]`, a numeric index, or `$..`.
- **Always an array.** One match still wraps. Tests that expect a bare string will fail until you take `[0]` in your own code.
- **Not a transform.** You cannot rename keys, drop fields, or emit a patched clone. Use the editor or jq.
- **Not SQL or GraphQL.** No joins, no live schema, no variables besides the path string.
- **Numbers are IEEE-754.** Huge integer ids can round in JavaScript before the path reads them. Keep those ids as strings in the source.
- **Large documents stall the tab.** Walking a multi-megabyte tree is an in-memory walk. Cut a slice locally or inspect stats on the [JSON file processor](https://www.toolcomb.com/json-file-processor) instead of querying a 40 MB log in the textarea.

## Privacy & Security - 100% Browser-Side Querying

Matching runs in your browser; the tool does not upload the document or path for processing. Browser extensions, shared devices and screenshots can still expose information entered on the page.

Your JSON and JSONPath are auto-saved to `localStorage` under a key unique to this tool for up to 30 days so you can resume the same catalog. The draft never leaves this device. Click Clear to restore the Ada/Grace sample. Clearing site data for this origin deletes the saved query as well.

## Frequently Asked Questions

### What is JSONPath?

JSONPath is a query language for selecting values in JSON. For example, $.items[*].id selects the id of each item in an array. This tool shows the matching values as an array.

### How does the default query $.items[*].id work?

The sample document is a catalog with two objects: Ada (id 1) and Grace (id 2). The default path $.items[*].id returns [1,2]. Path $.items[0].name returns ["Ada"]. Results are always wrapped as a JSON array.

### Is JSONPath the same as jq?

No. jq is a programming language that can map, reduce, and define functions. JSONPath only selects nodes. There is no reduce, no custom functions, and no file globbing. Use jq on your machine when you need a full transform language.

### Does this JSON query tool upload my document?

No. Matching runs entirely in the browser. The document and path stay in localStorage on this device for up to 30 days and are never sent to a server.

### Why are filters such as $.items[?(@.id==1)] rejected?

This tool does not support filter expressions such as $.items[?(@.id==1)]. If you know the position, use an index such as $.items[0], or select all items and inspect the results.

### Can I transform the JSON document, not only query it?

The output is the list of matches, pretty-printed as JSON. It is not a patch engine and it does not rewrite the source. Edit the original on the JSON editor, or compare versions on JSON compare.

### What does wrapping matches as an array mean?

A single match and many matches have the same shape: a JSON array. $.items[0].name returns ["Ada"], not the bare string Ada. That makes copy-paste into tests predictable.

### Does recursive descent such as $..id work?

Yes. $..id selects matching id properties at different levels of the document and returns the values in an array.

### Can I query JSON5, JSONC, or JSON with comments?

No. The document must parse as RFC 8259 JSON first. Comments, unquoted keys, and trailing commas fail before the path runs. Repair the draft on JSON repair or validate JSON5 on the JSON5 validator, then query the strict JSON.

### Is this JSONPath query tool free?

Yes. There is no registration, no usage cap, and no premium filter pack. Query as much JSON as your browser can hold in memory.

## Related JSON Tools

Querying is one step. These sibling tools cover edit, diff, repair, and validation on the same origin:

- [JSON editor](https://www.toolcomb.com/json-editor) - change values in text, tree, or table mode after you know which nodes matter.
- [JSON compare](https://www.toolcomb.com/json-compare) - deep-diff two documents by path when selection is not enough.
- [JSON repair](https://www.toolcomb.com/json-repair) - turn unquoted keys and trailing commas into RFC 8259 before a path can run.
- [JSON formatter](https://www.toolcomb.com/json-formatter) - pretty-print or minify a valid document without querying it.
- [JSON viewer](https://www.toolcomb.com/json-viewer) - expand a tree when you want to browse, not select.
- [JSON Schema validator](https://www.toolcomb.com/json-schema-validator) - check a contract instead of extracting fields.
- [JSON file processor](https://www.toolcomb.com/json-file-processor) - stats and pretty-print for large files in a worker.
- [JSON validator](https://www.toolcomb.com/json-validator) - syntax-only RFC 8259 check when the path should not run yet.

## Related Tools

Discover more free tools that might help with your next task.

[JSON Formatter Format and validate JSON data Use Tool](https://www.toolcomb.com/json-formatter)

[JSON Viewer View JSON data in a tree structure Use Tool](https://www.toolcomb.com/json-viewer)

[JSON Minifier Minify JSON data to reduce size Use Tool](https://www.toolcomb.com/json-minifier)

[JSON Editor Edit JSON in text, tree, and table modes. Works offline in the browser Use Tool](https://www.toolcomb.com/json-editor)

[JSON Compare Diff two JSON documents path by path Use Tool](https://www.toolcomb.com/json-compare)

[JSON Repair Repair malformed JSON into valid RFC 8259 text Use Tool](https://www.toolcomb.com/json-repair)

[View All Tools](https://www.toolcomb.com/tools)
