Quick revision
The short answer
When a service moves to Spring Boot 4 and Jackson 3, I would check four things: the new package names (core classes move to tools.jackson, while annotations stay in com.fasterxml.jackson.annotation), code that builds or reconfigures mappers (Jackson 3's JsonMapper is immutable and built through a builder), defaults that changed, especially around dates, and custom serializers and modules, whose base types were renamed. Before changing anything, I would capture the service's JSON output with tests, so I can compare the output before and after the upgrade.
What to remember
In this answer, we went through what I would check when a service moves to Jackson 3 with Spring Boot 4: imports and dependencies, since core classes move to tools.jackson while annotations stay in com.fasterxml.jackson.annotation; code that builds or reconfigures mappers, since JsonMapper is immutable and built with a builder; changed defaults, especially for dates, which need the release notes and measurement; and custom serializers and modules, whose base types were renamed. Golden-file tests written before the upgrade compare the JSON output before and after, and a sample of stored payloads checks data at rest.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
When a service moves to Spring Boot 4 and Jackson 3, I would check four things: the new package names (core classes move to tools.jackson, while annotations stay in com.fasterxml.jackson.annotation), code that builds or reconfigures mappers (Jackson 3's JsonMapper is immutable and built through a builder), defaults that changed, especially around dates, and custom serializers and modules, whose base types were renamed. Before changing anything, I would capture the service's JSON output with tests, so I can compare the output before and after the upgrade.
Why this question is asked
Jackson is so central to a Spring service that a major version change touches places nobody thinks of: request and response bodies, Kafka messages, cached values in Redis, audit logs and test fixtures. Most of the changes are mechanical, but a changed default can quietly alter the JSON that clients receive, and that is the part a compiler will not catch. Interviewers ask this to see whether we approach an upgrade with a checklist and evidence rather than hope. In this answer, we will recap what changes in Jackson 3, walk through the checks in the order I would do them, and finish with the tests that prove the JSON did not change. Exact class names and defaults should be confirmed against the Jackson 3 and Spring Boot 4 release notes for the versions in use.
1A Quick Recap of What Jackson 3 Changes
Jackson 3 is a new major version, so it was allowed to break compatibility. Its Maven group ids and Java packages for core and databind change from com.fasterxml.jackson to tools.jackson, which lets Jackson 2 and 3 live side by side on one classpath during a migration. The annotations module is the exception: annotations such as @JsonProperty stay in com.fasterxml.jackson.annotation and are shared by both versions, so DTOs annotated for Jackson 2 usually need no change.
Jackson 3 also requires Java 17, makes the mapper immutable, turns its exceptions into unchecked ones (JacksonException extends RuntimeException), builds java.time support into databind, and revisits several defaults. Spring Boot 4 uses Jackson 3 by default and keeps some Jackson 2 support for a transition period; check the Boot 4 release notes for how long.
2Check 1: Imports and Dependencies
The first pass is mechanical. Every import of ObjectMapper, JsonNode, JsonParser and the like changes package, and explicit dependencies on com.fasterxml.jackson.core:jackson-databind or the jsr310 datatype module must go or be replaced. A search for com.fasterxml.jackson outside the annotation package shows the size of the job.
Notice that a service can compile against both versions for a while if a library still brings Jackson 2. That is useful during migration, but it is also a trap: a library may serialize with its own Jackson 2 mapper and ignore the service's Jackson 3 configuration, so we list which libraries still pull Jackson 2 with mvn dependency:tree or gradle dependencies.
3Check 2: Code That Builds or Changes Mappers
In Jackson 2 we could create a mapper and call configure() or registerModule() on it at any time. In Jackson 3 the mapper is immutable: all configuration goes through JsonMapper.builder(), and to change a setting we call rebuild() and get a new mapper. Code that reconfigures a shared mapper at runtime no longer compiles, which is a good thing, because that code was a thread-safety bug anyway.
In Spring Boot code, the bigger change is in configuration classes. A Jackson2ObjectMapperBuilderCustomizer becomes a JsonMapperBuilderCustomizer, and code that injects ObjectMapper may want JsonMapper. Every place that defines its own mapper bean deserves a second look, because it may have been hiding Boot's configuration already.
4Check 3: Defaults That Changed
This is the check that protects clients. Jackson 3 changed some defaults to what most applications configured anyway, and Spring Boot sets its own defaults on top, so the net effect differs per service. Areas to read carefully in the release notes are date and time handling (whether dates are written as timestamps, and time zone handling), property ordering, how null is handled for primitives and enums, and what happens with unknown properties and unknown enum values.
A service that used Boot's mapper in Boot 3 and Boot's mapper in Boot 4 may see few differences, because Boot pins the important ones. A service that built its own mapper with new ObjectMapper() is the one most likely to change output, because it was relying on Jackson 2's own defaults. We cannot reason our way to certainty here; we measure, as the last section shows.
| Area | What to look for | Risk to clients |
|---|---|---|
| Imports and dependencies | com.fasterxml.jackson outside annotations | None, compile errors |
| Mapper creation | new ObjectMapper(), configure(), registerModule() | Low, compile errors |
| Spring config | Jackson2ObjectMapperBuilderCustomizer, ObjectMapper beans | Medium |
| Changed defaults | dates, ordering, nulls, unknown values | High, silent changes |
| Custom serializers | JsonSerializer, SerializerProvider, Module | Medium |
| Other JSON users | Kafka, Redis, caches, audit logs | High, stored data |
5Check 4: Custom Serializers and Modules
Custom serializers need code changes because the base types were renamed. In Jackson 3, JsonSerializer and JsonDeserializer become ValueSerializer and ValueDeserializer, SerializerProvider becomes SerializationContext, Module becomes JacksonModule (SimpleModule remains), some generator methods are renamed (for example writeFieldName becomes writeName), and methods no longer declare IOException. StdSerializer and StdDeserializer still exist as convenient base classes. Third-party modules, such as those for Kotlin, Joda or money types, need Jackson 3 versions, and their availability can decide when a service can move.
6Proving the JSON Did Not Change
The most valuable step happens before the upgrade. We write golden-file tests: for each important DTO and event type, we build a representative object, serialize it with the current Jackson 2 setup, and store the JSON in a file. The test serializes again and compares, and it also deserializes the stored JSON to check reading still works. After switching to Boot 4, the same tests run against Jackson 3. Any difference is either a bug to fix with configuration or an intended change we announce to clients.
We also cover data at rest. JSON stored in Redis, a database column or a Kafka topic was written by the old version and will be read by the new one, sometimes months later. A test that reads a sample of real stored payloads with the new mapper catches problems that request-level tests miss.
7Follow-up questions
Can Jackson 2 and Jackson 3 run in the same application?
Yes. Because the packages and group ids differ, both can be on the classpath, and they share the annotations module. That helps when a library has not moved yet, but each mapper has its own configuration, so we must make sure the library's output still matches what clients expect.
Do I need to change annotations on my DTOs?
Usually not. Annotations stay in com.fasterxml.jackson.annotation and work with both versions. Annotations that live in databind, such as @JsonSerialize and @JsonDeserialize, move to the tools.jackson package, so those imports do change.
What about exception handling around Jackson calls?
Jackson 3 exceptions are unchecked, rooted in JacksonException. Code that caught JsonProcessingException or IOException around readValue needs updating, and error handlers that map Jackson exceptions to 400 responses should be checked so malformed JSON still produces a client error, not a 500.
8Conclusion
In this answer, we went through what I would check when a service moves to Jackson 3 with Spring Boot 4: imports and dependencies, since core classes move to tools.jackson while annotations stay in com.fasterxml.jackson.annotation; code that builds or reconfigures mappers, since JsonMapper is immutable and built with a builder; changed defaults, especially for dates, which need the release notes and measurement; and custom serializers and modules, whose base types were renamed. Golden-file tests written before the upgrade compare the JSON output before and after, and a sample of stored payloads checks data at rest.
Open with
I'd split the upgrade into what the compiler catches and what it doesn't. The compiler part: Jackson 3 moves core and databind to the tools.jackson packages and group ids, while annotations like @JsonProperty stay in com.fasterxml.jackson.annotation, so DTOs mostly stay as they are.
Then, if they want more
The mapper becomes immutable: no more configure or registerModule on a live mapper, everything goes through JsonMapper.builder(), and changes mean rebuild(). In Spring config, Jackson2ObjectMapperBuilderCustomizer becomes JsonMapperBuilderCustomizer. Custom serializers need the renamed types, like ValueSerializer and SerializationContext, and exceptions are unchecked now. Third-party modules need Jackson 3 versions.
The part the compiler doesn't catch is changed defaults, especially for dates and time zones, ordering and null handling. I'd read the release notes, but mainly I'd measure. Before touching anything, I'd add golden-file tests that serialize representative DTOs and events with the current setup and store the JSON, and also read the stored JSON back.
After the upgrade the same tests show every difference, and I either fix it with configuration or announce it. I'd also read a sample of JSON stored in Redis, the database or Kafka with the new mapper, because data at rest outlives the release.
Services that built their own ObjectMapper are the ones I'd look at first, since they relied on Jackson 2's own defaults.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 4, Java 17, Spring Boot 3
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Spring Boot 4 moves to Jackson 3. What changes would you check when upgrading a service?": https://scrivio-interview-library.netlify.app/spring-boot/json-serialization/88ee9a81f2/