Migrate ObjectMapper to JsonMapper
04:24 13 Apr 2026

I am currently upgrading my application to Jackson 3.x (and Spring Boot 4.0). I have an existing ObjectMapper bean in Jackson 2 that manually configures JavaTimeModule with specific DateTimeFormatter patterns and several feature toggles.

In Jackson 3, I've noticed that ObjectMapper is now immutable and follows a builder pattern, and the package names have changed from com.fasterxml.jackson to tools.jackson. Additionally, the JavaTimeModule (jsr310) seems to be integrated by default.

@Bean
public ObjectMapper objectMapper() {
  JavaTimeModule module = new JavaTimeModule();
  ObjectMapper mapper = new ObjectMapper();
  
  module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ISO_DATE_TIME));
  module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ISO_DATE_TIME));
  module.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ISO_DATE));
  module.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ISO_DATE));
  
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  mapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
  mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
  mapper.registerModule(module);

  mapper.setSerializationInclusion(Include.NON_NULL);
  return mapper;
}
How do I recreate this specific configuration (especially the custom DateTimeFormatter for LocalDateTime and LocalDate) using the new Jackson 3 Builder API? Can I still add custom serializers/deserializers to the "built-in" time support, or should I still register a module?
java jackson-3