You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2020/03/19 12:03:00 UTC
[jira] [Commented] (CAMEL-14679) Support DROP_ROOT_MODE in XStream
JSON dataformat
[ https://issues.apache.org/jira/browse/CAMEL-14679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17062499#comment-17062499 ]
Claus Ibsen commented on CAMEL-14679:
-------------------------------------
You can now enable this but keep it disabled to be as before.
Mind that for json, then jackson or some of the other libraries are better. xstream was for xml, and then they added some json support on top, but its not first class imho.
> Support DROP_ROOT_MODE in XStream JSON dataformat
> --------------------------------------------------
>
> Key: CAMEL-14679
> URL: https://issues.apache.org/jira/browse/CAMEL-14679
> Project: Camel
> Issue Type: Improvement
> Components: camel-xstream
> Reporter: Peter Palaga
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 3.2.0
>
>
> It is currently not possible to configure {{org.apache.camel.dataformat.xstream.JsonDataFormat}} to produce standard JSON without the XStream specific root node.
> XStream JSON with root node:
> {code:json}
> {"org.apache.camel.quarkus.component.xstream.it.PojoA\:{"name":"Joe"}}{code}
> Standard JSON:
> {code:json}
> {"name":"Joe"}{code}
> With plain Xstream this can be reached via (see https://x-stream.github.io/json-tutorial.html#json-dropping-root )
> {code:java}
> XStream xstream = new XStream(new JsonHierarchicalStreamDriver() {
> public HierarchicalStreamWriter createWriter(Writer writer) {
> return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE);
> }
> });
> {code}
> But I have not found a way to configure the {{org.apache.camel.dataformat.xstream.JsonDataFormat}} in that way. So we probably need some change to allow this.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)