--- id: LANG-23 family: GR-LANG level: extended profiles: [runtime] posture: normative-target added: "1.0" changed: "1.0" source: https://flowdrop.io/spec/rules/gr-lang/lang-23 specification: FlowDrop Workflow Specification 1.0 licence: CC BY 4.0 --- # LANG-23 — Only a `$`-rooted JSONPath query unwraps a list to its first match *GR-LANG (Part I) · level: extended · profiles: runtime · added in 1.0* ## The rule > **Normative.** This is the rule. > > 1. An extractor MUST reduce an array result to its first match where its engine is jsonpath, the path is `$`-rooted, and extract-all is off. > > 2. It MUST NOT reduce an array result otherwise. > > 3. A property-path engine MUST deliver an array result whole, even for a `$`-prefixed path. > > 4. A jsonpath engine that falls back to property-path resolution MUST NOT unwrap. > > 5. The extractor's reported JSONPath flag MUST report the `$` prefix alone. > > 6. It MUST NOT depend on the engine in force. ## What it means Whether an array 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 array either way; only the engine differs, against the same `$`-rooted path. ```json title="The data output under the property-path engine" verdict="whole" ["first", "second"] ``` ```json title="The data output under the jsonpath engine, same path" verdict="unwrapped" "first" ``` Both report the path as a JSONPath query (`is_jsonpath` true); only the second reduces it, and only the second counts two matches. ## Why Recorded under [OPEN-25](https://flowdrop.io/spec/rulings/open-25). ## Related rules - Names: LANG-14, LANG-15 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.