davsclaus opened a new pull request, #27297:
URL: https://github.com/apache/camel/pull/27297
## Description
The JsonPath page shows filtering a JSON array by a header with `resultType:
java.util.List`, a size check and `${body[0]}`. When the filter matches on a
unique key there is a shorter form: with a non-collection `resultType` such as
`java.util.Map`, one match is returned as the element and no match as `null`.
This adds that form (Java, XML, YAML tabs) next to the List one, plus a note:
- more than one match also returns `null`, so use it only when at most one
element can match
- `unpackArray` does not cover this: it unpacks a single-element list but
leaves an empty list as `[]`
The YAML and XML snippets were run with `camel run` against a three-item
`stock.json`: a known SKU returns the item marshalled to JSON, an unknown SKU
returns 404 with `unknown SKU <sku>`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]