# JSONPath Query

> Query any JSON document with JSONPath syntax — extract fields, filter arrays, count matches. A free, in-browser jq-lite for everyday JSON inspection.

URL: https://uttir.com/jsonpath
Categories: data-tools, developer-tools
Privacy: Query runs locally in your browser. Your JSON never leaves the page.

## About

JSONPath is the query language for JSON — it lets you pull a single value out of a deeply nested response, filter an array of records to those that match a condition, or count how many items have a particular shape. It plays the same role for JSON that XPath plays for XML, or that jq plays at the command line.

This tool runs the expression against the JSON you paste and returns every match. It supports the operators AI assistants and config tools (kubectl, jq-lite, GitHub Actions ${{ jsonPath(...) }}) reach for most: $ for root, dot and bracket member access, [n] and [-1] for indexing, [*] for wildcard, $.. for recursive descent, and [?(@.key op value)] for filtering. It does not cover every corner of the JSONPath spec — it covers the parts that are useful in day-to-day work.

## How to use

1. **Paste your JSON** — Drop a JSON document into the input. The tool validates it and shows a tree preview below.
2. **Write a JSONPath expression** — Start with $, then dot/bracket through the structure. Use [*] for all items, [0] for the first, [?(@.active == true)] to filter.
3. **Read the matches** — Every match is shown in a list with its JSON value. The count at the top tells you how many results the expression returned.

## Examples

### First user name

Pull the first user's name from an array of users.

Input:

```
$.users[0].name
```

Output:

```
"Ada Lovelace"
```

### Active users only

Filter an array of users to those with active = true.

Input:

```
$.users[?(@.active == true)]
```

Output:

```
[{"id":1,"name":"Ada","active":true},{"id":3,"name":"Linus","active":true}]
```

### Every email address

Use recursive descent to find every value of any "email" key anywhere in the document.

Input:

```
$..email
```

Output:

```
["ada@example.com", "linus@example.com"]
```

## FAQ

### What operators are supported?

$.foo.bar for member access, [0] / [-1] for array index, [*] for all elements, $..foo for recursive descent (finds "foo" at any depth), and [?(@.key op value)] for filters with =, !=, <, and >. Strings, numbers, and booleans compare correctly.

### Why does my expression return zero results?

Most zero-result queries are one of three things: a typo in a member name (JSONPath is case-sensitive), a missing root $ (the expression must start with $), or expecting an array when the value is actually an object (or vice versa). The tree preview below the input shows the actual shape.

### Is this jq?

JSONPath and jq are related but different. jq is more expressive (it has pipes, conditionals, and reduction operators). JSONPath is the simpler read-only selector language that most config tools and AI assistants actually use. This tool is a strict JSONPath implementation — for full jq, use a CLI.

## Related tools

- [JSON Formatter](https://uttir.com/json-formatter) — Format, beautify, and validate JSON with adjustable indentation — instantly in your browser.
- [JSON Diff](https://uttir.com/json-diff) — Compare two JSON values semantically. Ignores key order, highlights added/removed/changed paths, and works with nested objects and arrays.
- [JSON Tree Viewer](https://uttir.com/json-tree-viewer) — Paste any JSON and explore it as a collapsible tree. Click any value to copy it, or copy the whole path. Free, runs in your browser, no upload.
- [JSON to YAML Converter](https://uttir.com/json-to-yaml) — Convert JSON to clean YAML and decode YAML back to JSON. Round-trips common JSON shapes.

---

For the full HTML page with the live tool, visit https://uttir.com/jsonpath.
This file is the markdown rendering at https://uttir.com/jsonpath.md. See https://uttir.com/llms.txt for a site-wide summary.
