Why extract JSON by path
API payloads nest deeply—data.user.profile.email is hard to spot by eye. ComTools JSONPath Query (Tools/Json/Path) evaluates a path locally and prints the result as formatted JSON.
Input format (important)
- Line 1: path expression (e.g.
$.user.name) - Line 2+: full JSON body
If you paste only one line of valid JSON, the path defaults to $ (entire document).
Path syntax
| Path | Meaning |
|---|---|
$ |
Whole JSON |
$.user |
user under root |
$.user.name |
Nested property |
$.tags |
The array itself |
This is a dot-path subset of JSONPath: $.a.b.c works. Filters / recursive descent ($..name, [?(@.id==1)]) are not supported. Array indexes can use forms like $.tags.0.
Steps
- Open JSONPath Query.
- Put the path on line 1 and JSON below (or click Sample:
$.user.name+ object). - Click Run.
- Copy the extracted value from the output.
Nothing is uploaded—parsing stays in the browser.
Example
Input:
$.user.name
{
"user": {
"id": 1,
"name": "ComTools",
"active": true
},
"tags": ["json", "excel", "image"]
}
Output:
"ComTools"
Use $.user for the whole object. Missing paths return null.
Common scenarios
| Scenario | Approach |
|---|---|
| Need one field | $.data.user.name (match your shape) |
| Inspect a section | $.settings |
| Get a list | $.tags |
| Validate first | JSON Validator |
| Hard to read | Format first |
Related tools
| Need | Tool |
|---|---|
| Path extract | JSONPath |
| Pretty-print tree | JSON Formatter |
| Array → table | JSON to CSV |
| Diff two payloads | JSON Compare |
Notes
- Standard JSON only; keep the path on its own first line.
- Dot paths only—not the full JSONPath spec.
- If an intermediate node is null/undefined, the result is
null.
FAQ
$.items[*].id?
Wildcards/filters are not supported—extract $.items or query $.items.0 style indexes.
Is $ required?
Recommended; leading $ / $. is stripped before splitting on dots.
vs jq?
Instant in the browser with a simpler syntax; use jq for advanced queries.