Extracting all matches for a property path always yields a list
The rule
Normative: this is the rule
- Extracting all matches for a property path MUST yield an array.
- A single match MUST be wrapped in a one-element array.
- A path that reads a stored
nullmatches it, and MUST yield a one-element array holdingnull. - A path that matches nothing MUST yield the empty array.
What it means
Extracting all matches never hands back the bare value it found — even where the path can only ever match one thing, the result is still an array, so calling code does not need two shapes depending on what the path looked like. The sharper edge is the null case: a path that reads a stored null found something, so it comes back as a one-element array holding that null. Only a path that matched nothing at all gives the empty array.
Example
Extracting all matches for store.name, a path that can only ever match one
value:
["Test Store"]{"key": null}[null]Why
Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · LANG-19 · changed in spec 1.0