Claus Ibsen created CAMEL-25986:
-----------------------------------
Summary: camel-jolt - with the default inputType a JSON text body
is not parsed, and the spec gives null
Key: CAMEL-25986
URL: https://issues.apache.org/jira/browse/CAMEL-25986
Project: Camel
Issue Type: Bug
Components: camel-jolt
Affects Versions: 4.18.0, 4.22.0, 4.23.0
Reporter: Claus Ibsen
Fix For: 4.24.0
With the default {{inputType}}, {{Hydrated}}, the jolt producer passes the body
to the spec as it is ({{JoltEndpoint}}, main e6885df7894d, line 212). Only
{{inputType=JsonString}} parses JSON text (line 209). A JSON text body, which
is what most consumers give (a JMS text message, an HTTP request, a file),
therefore reaches the spec unparsed: Shiftr takes it as one scalar and gives
null, and Defaultr, Removr and Sortr give the text back. There is no error.
Checked on 4.24.0-SNAPSHOT with {{camel run}} and a shift spec {{\{"name":
"fullName"\}}}:
* the body {{\{"name": "Camel"\}}} as text, with the default options, gives
null;
* the same text with {{inputType=JsonString&outputType=JsonString}} gives
{{\{"fullName":"Camel"\}}};
* the same JSON as a Map, with the default options, gives a Map with fullName.
The examples of the component docs sent a JMS text message to the default
options; they now set inputType and outputType to JsonString (CAMEL-24961).
*Proposed change*: with {{Hydrated}}, parse a body that is text, bytes, a
stream or a file, as {{JsonString}} does, and keep a Map or a List as it is; or
fail with a clear error that says to set {{inputType=JsonString}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)