Only a $-rooted JSONPath query unwraps a list to its first match
The rule
Normative: this is the rule
- An extractor reduces a list result to its first match only where its engine is jsonpath, the path is
$-rooted, and extract-all is off. - A property-path engine delivers a list result whole, even for a
$-prefixed path, and a jsonpath engine that falls back to property-path resolution never unwraps. - The extractor's reported JSONPath flag reports the
$prefix alone and is independent of the engine in force.
What it means
Whether a list result gets reduced to its first match turns on which engine
ran, not on what the path string looks like. A $-rooted path evaluated by
the property-path engine is still read as a property path — the leading $
is not enough on its own to trigger the reduction. The flag that reports
whether the path looked like a JSONPath query is independent of this: it
answers the prefix question alone, so it can read true for a path the
property-path engine went on to deliver whole, unreduced.
Example
The evaluator returns the same two-element list either way; only the engine
differs, against the same $-rooted path.
["first", "second"]"first"Both report the path as a JSONPath query (is_jsonpath true); only the
second reduces it, and only the second counts two matches.
Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0-draft · LANG-23 · changed in spec 1.0