About JSON Query
The syntax, in one place
$ is the document. .name takes a key, [0] takes an index, [*] takes every element, and .. searches at any depth — so $..email finds every email in a response however deeply it is nested.
Filters select from a list: $.users[?(@.active == true)].name, where @ is the element being tested.
One match or a list
A JSONPath query always produces a list, even when it matches once. "Unwrap single match" hands you the value itself instead of a one-item list, which is what you want when feeding a block that expects a single value.
Leave it off when the count matters — a query that matches nothing and one that matches once should not look the same downstream.
Implementations disagree
JSONPath was a blog post in 2007 and only became a standard (RFC 9535) in 2024. Libraries differ in the corners: filter syntax, whether $..* includes the root, how they order results from a recursive search.
Keep queries to the common subset above and they behave the same here, in jq-style tools, and in most server libraries.
Common questions
- Why does my query return nothing?
- Usually a key that does not exist at that level, or an array where an object was expected. Open the document in the JSON viewer and copy the path from the row you want — it is written in this same syntax.
- How do I get every item of an array?
- Use [*], as in $.items[*].id. Without it you are asking for the array itself, which is one match containing everything.
- Is JSONPath the same as jq?
- No. jq is a full language with its own pipelines and functions; JSONPath is a path expression for selecting values. For picking a value out of a response, JSONPath is usually shorter.