Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 33. Jackson
Marshal POJOs to JSON and back using Jackson
33.1. What’s inside Copier lienLien copié sur presse-papiers!
Please refer to the above link for usage and configuration details.
33.2. Maven coordinates Copier lienLien copié sur presse-papiers!
Create a new project with this extension on code.quarkus.redhat.com
Or add the coordinates to your existing project:
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jackson</artifactId> </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jackson</artifactId>
</dependency>
33.3. Usage Copier lienLien copié sur presse-papiers!
33.3.1. Configuring the Jackson ObjectMapper Copier lienLien copié sur presse-papiers!
There are a few ways of configuring the ObjectMapper
that the JacksonDataFormat
uses. These are outlined below.
33.3.1.1. ObjectMapper created internally by JacksonDataFormat Copier lienLien copié sur presse-papiers!
By default, JacksonDataFormat
will create its own ObjectMapper
and use the various configuration options on the DataFormat
to configure additional Jackson modules, pretty printing and other features.
33.3.1.2. Custom ObjectMapper for JacksonDataFormat Copier lienLien copié sur presse-papiers!
You can pass a custom ObjectMapper
instance to JacksonDataFormat
as follows.
33.3.1.3. Using the Quarkus Jackson ObjectMapper with JacksonDataFormat Copier lienLien copié sur presse-papiers!
The Quarkus Jackson extension exposes an ObjectMapper
CDI bean which can be discovered by the JacksonDataFormat
.
If you are using the JSON binding mode in the Camel REST DSL and want to use the Quarkus Jackson ObjectMapper
, it can be achieved as follows.
You can perform customizations on the Quarkus ObjectMapper
with a ObjectMapperCustomizer
.
It’s also possible to @Inject
the Quarkus ObjectMapper
and pass it to the JacksonDataFormat
.