Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14679

Support DROP_ROOT_MODE in XStream JSON dataformat

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.0
    • Component/s: camel-xstream
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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:

      {"org.apache.camel.quarkus.component.xstream.it.PojoA\:{"name":"Joe"}}

      Standard JSON:

      {"name":"Joe"}

      With plain Xstream this can be reached via (see https://x-stream.github.io/json-tutorial.html#json-dropping-root )

      XStream xstream = new XStream(new JsonHierarchicalStreamDriver() {
          public HierarchicalStreamWriter createWriter(Writer writer) {
              return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE);
          }
      });
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              ppalaga Peter Palaga
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: