My name is Mumshad Mannambeth. This lesson extends the basics of JSONPath by focusing on the wildcard (star) operator and how it behaves with both objects and arrays.

- The wildcard (
*) selects all properties at an object level or all elements in an array. - Use
.*for object-level wildcards and[*]for array wildcards. - The recursive-descent operator (
..) can find matching fields anywhere in the JSON tree (use it when the nesting depth is unknown).
car and bus. Each child has color and price.
Example JSON:
car or bus by using the object wildcard:
The
* wildcard selects all properties at the current object level. In the example above, $.*.color retrieves the color property from every top-level property (such as car and bus).model and location.
Example JSON (array of objects):
[*]:
[*] means “every item in the array.”
Combining object and array wildcards
Now combine both patterns: a top-level object with car and bus, each containing a wheels array.
Example JSON (nested structure):
car:
car:
bus:
car and bus by using both object and array wildcards:
The recursive-descent operator
.. searches the entire document for matching field names at any depth. Use it when you don’t know the exact nesting, but be aware it can return broader results than a targeted wildcard. For the example above, $..wheels[*].model finds the same wheel models but will also match wheels fields deeper in other branches of a larger document.
Practical tips
- Build queries incrementally: query a single branch (e.g.,
$.car) first, verify results, then generalize with*once you understand the structure. - Prefer targeted wildcards (
$.*.fieldor$.path[*].field) for predictable output; use..only when necessary. - Combine object and array wildcards to flatten nested collections (e.g.,
$.*.wheels[*].model).
- JSONPath overview and syntax: https://goessner.net/articles/JsonPath/
- JSONPath examples and tools: https://github.com/json-path/JsonPath