...
Multiple modules can be specified separated by comma, such as moduleRefs="myJacksonModule,myOtherModule"
Enabling or disable features using Jackson
Available as of Camel 2.15
Jackson has a number of features you can enable or disable, which its ObjectMapper uses. For example to disable failing on unknown properties when marshalling, you can configure this using the disableFeatures:
Code Block |
---|
<dataFormats>
<json id="json" library="Jackson" unmarshalTypeName="com.foo.MyPojo" disableFeatures="FAIL_ON_UNKNOWN_PROPERTIES"/>
</dataFormats> |
You can disable multiple features by separating the values using comma. The values for the features must be the name of the enums from Jackson from the following enum classes
- com.fasterxml.jackson.databind.SerializationFeature
- com.fasterxml.jackson.databind.DeserializationFeature
- com.fasterxml.jackson.databind.MapperFeature
To enable a feature use the enableFeatures options instead.
From Java code you can use the type safe methods from camel-jackson module:
Code Block |
---|
JacksonDataFormat df = new JacksonDataFormat(MyPojo.class);
df.disableFeature(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
df.disableFeature(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); |
Dependencies for XStream
To use JSON in your camel routes you need to add the a dependency on camel-xstream which implements this data format.
...