Skip to main content
Hello — welcome to this JSONPath demo.
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.
An orange presentation slide with the title "JSON PATH" and the subtitle "PART - 2 - WILD CARD." Faint network node graphics appear in the background and a small circular timer marked "22" is in the top right.
Overview
  • 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).
Object wildcard examples We reuse a simple top-level object with two child objects, car and bus. Each child has color and price. Example JSON:
Get the color of the car:
Result:
Get the color of the bus:
Result:
Get all colors without specifying car or bus by using the object wildcard:
Result:
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).
Array wildcard examples Consider an array of wheel objects; each wheel has a model and location. Example JSON (array of objects):
Get the model of the first wheel (index 0):
Result:
Get the model of the fourth wheel (index 3):
Result:
Get the models of all wheels in the list using the array wildcard [*]:
Result:
Within arrays, [*] 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):
Get the model of the first wheel of the car:
Result:
Get the models of all wheels of the car:
Result:
Get the models of all wheels of the bus:
Result:
Get the models of all wheels across car and bus by using both object and array wildcards:
Result:
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.
Quick reference table 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 ($.*.field or $.path[*].field) for predictable output; use .. only when necessary.
  • Combine object and array wildcards to flatten nested collections (e.g., $.*.wheels[*].model).
Links and references That’s it for this lesson — try these queries on different JSON samples to see how the wildcard and recursive-descent operators behave.

Watch Video

Practice Lab