Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Code Block
    <dataFormats>
      <jacksonxml id="jsonjacksonxml" include="NOT_NULL"/>
    </dataFormats>

...

If you use jackson to unmarshal json XML to POJO, then you can now specify a header in the message that indicate which class name to unmarshal to.
The header has key CamelJacksonUnmarshalType if that header is present in the message, then Jackson will use that as FQN for the POJO class to unmarshal the XML payload as.

...

Code Block
    <dataFormats>
      <jacksonxml id="jsonjacksonxml" allowJmsType="true"/>
    </dataFormats>

Unmarshalling from

...

XML to List<Map> or List<pojo>

If you are using Jackson to unmarshal XML to a list of map/pojo, you can now specify this by setting useList="true" or use the org.apache.camel.component.jacksonxml.ListJacksonXMLDataFormat. For example with Java you can do as shown below:

...

Code Block
    <bean id="myJacksonModule" class="com.foo.MyModule">
      ... // configure the module as you want
    </bean>
 
    <dataFormats>
      <jacksonxml id="jsonjacksonxml" useList="true" unmarshalTypeName="com.foo.MyPojo" moduleRefs="myJacksonModule"/>
    </dataFormats>

...

Code Block
 <dataFormats>
      <jacksonxml id="jsonjacksonxml" unmarshalTypeName="com.foo.MyPojo" disableFeatures="FAIL_ON_UNKNOWN_PROPERTIES"/>
 </dataFormats>

...

Using the prettyPrint option one can output a well formatted JSON while XML while marshalling:

Code Block
 <dataFormats>
      <jacksonxml id="jack" prettyPrint="true"/>
 </dataFormats>

...