...
Please note that as of Camel 2.16 there’re 5 different overloaded json()
DSL methods which support the prettyPrint
option in combination with other settings for JsonLibrary
, unmarshalType
, jsonView
etc.
Integrating Jackson with Camel's TypeConverters
Available as of Camel 2.17
The camel-jackson
module allows to integrate Jackson as a Type Converter in the Camel registry. This works in similar ways that camel-jaxb
integrates with the type converter as well. However camel-jackson
must be explicit enabled, which is done by setting some options on the CamelContext
properties, as shown below:
Code Block |
---|
// enable Jackson json type converter
getContext().getProperties().put("CamelJacksonEnableTypeConverter", "true");
// allow Jackson json to convert to pojo types also (by default jackson only converts to String and other simple types)
getContext().getProperties().put("CamelJacksonTypeConverterToPojo", "true"); |
The camel-jackson
type converter integrates with JAXB which means you can annotate POJO class with JAXB annotations that Jackson can leverage.
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.
...