atiaomar1978-hub opened a new pull request, #24995: URL: https://github.com/apache/camel/pull/24995
## Summary Fixes [CAMEL-24230](https://issues.apache.org/jira/browse/CAMEL-24230): with `writeAsString=true`, a JsonPath expression that evaluates to a single JSON object (e.g. `$.args`) now returns a valid JSON **String** instead of a `java.util.Map` whose `toString()` looks like `{age=30, name="Alice"}`. **Root cause:** `JsonPathEngine` had a special `Map` branch that only stringified individual values and returned the Map itself. Non-iterable results (including Maps) now use `adapter.writeAsString(answer, exchange)` like scalars already did. **Regression fix:** `JsonPathSplitWriteAsStringMapTest` updated to split on `$.content.*` (array of object values) instead of relying on the old Map-entry behaviour. ## Test plan - [x] `JsonPathWriteAsStringObjectTest` (4) — route-level setHeader/setBody with `jsonpathWriteAsString("$.args")`, nested object, valid JSON output (AssertJ + JsonNode comparison) - [x] `JsonPathEngineWriteAsStringTest` (3) — engine unit tests: object → JSON string, flag off → Map, array → List of JSON strings - [x] Updated `JsonPathSplitWriteAsStringMapTest` — split on `$.content.*` expects String bodies - [x] Full module: `mvn test -pl components/camel-jsonpath` — **119 tests passed** - [x] Code formatted (`formatter:format`, `impsort:sort`) --- _Generated by Cursor Agent on behalf of @atiaomar1978-hub._ -- 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]
