Jackson Configuration
The Jackson ObjectMapper can be configured through normal configuration with the JacksonConfiguration class.
All jackson configuration keys start with jackson
.
dateFormat | String | The date format |
locale | String | Uses Locale.forLanguageTag. Example: |
timeZone | String | Uses TimeZone.getTimeZone. Example: |
serializationInclusion | String | One of JsonInclude.Include. Example: |
propertyNamingStrategy | String | Name of an instance of PropertyNamingStrategy. Example: |
defaultTyping | String | The global defaultTyping for polymorphic type handling from enum ObjectMapper.DefaultTyping. Example: |
Example:
jackson:
serializationInclusion: ALWAYS
Features
All features can be configured with their name as the key and a boolean to indicate enabled or disabled.
serialization | Map | |
deserialization | Map | |
mapper | Map | |
parser | Map | |
generator | Map |
Example:
jackson:
serialization:
indentOutput: true
writeDatesAsTimestamps: false
deserialization:
useBigIntegerForInts: true
failOnUnknownProperties: false
Support for @JsonView
You can use the @JsonView
annotation to controller methods if you set jackson.json-view.enabled
to true
in application.yml
.
Jackson’s @JsonView
annotation allows you to control which properties are exposes on a per response basis. See Jackson JSON Views for more information.
Beans
In addition to configuration, beans can be registered to customize Jackson. All beans that extend any of the following classes will be registered with the object mapper.
Service Loader
Any modules registered via the service loader will also be added to the default object mapper.