Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

Shared libraries in your company expose Jackson 2 types (ObjectMapper parameters, JsonNode return values) in their public APIs. How do you manage the Jackson 3 transition across 120 services?

When shared libraries put ObjectMapper or JsonNode in their public APIs, every consumer is tied to the same Jackson major version, so 120 services would have to move together. I would publish library versions that support Jackson 3, possibly as a parallel artifact, and use the moment to remove Jackson types from library APIs where possible, taking Strings, byte arrays or our own types. The order is shared libraries first, then services with their Spring Boot 4 upgrade, protected by contract tests on message formats, with progress tracked per service and an end date for Jackson 2.

Why this question is asked

A shared library is a promise to many teams at once. If its method signature mentions a class from another library, that class becomes part of the promise too, and upgrading it becomes everyone's problem. The Jackson 3 transition makes this concrete, because com.fasterxml.jackson.databind.JsonNode and tools.jackson.databind.JsonNode are different types. Interviewers ask this design question to see whether we can manage a dependency change across a whole organisation. In this answer, we will see why Jackson types in APIs couple everyone, look at the options for the libraries, the order of the migration, the tests that protect payloads, and how to track the programme.

1Why Jackson Types in Public APIs Couple Everyone

Consider a shared events library with a method publish(String topic, JsonNode payload) and a client library that returns JsonNode from its calls. A service that upgrades to Spring Boot 4 now has a Jackson 3 JsonNode in its hands, but the library wants the Jackson 2 one. The two classes have different packages, so the code does not compile, and there is no cast between them. The service cannot upgrade until the library offers a Jackson 3 signature, and a library with a Jackson 3 signature cannot be used by services still on Spring Boot 3.

Java
// Shared library, version 5.x, built on Jackson 2
public interface EventPublisher {
void publish(String topic, com.fasterxml.jackson.databind.JsonNode payload);
}
// Service on Spring Boot 4 / Jackson 3
tools.jackson.databind.JsonNode node = mapper.valueToTree(event);
publisher.publish("orders", node);
// compile error: incompatible types, tools.jackson...JsonNode is not com.fasterxml...JsonNode

So a Jackson type in an API turns a library upgrade into a lock-step move. With 120 services, lock-step means the slowest team sets everyone's pace.

2Option 1: Parallel Library Versions

The direct answer is to publish Jackson 3 versions of each affected library. One way is a new major version, events 6.x on Jackson 3 while 5.x stays on Jackson 2 and receives fixes. Another is a parallel artifact, events-jackson2 and events-jackson3, built from one source tree with a thin adapter per Jackson version. Because Jackson 2 and 3 use different packages, a service can even depend on both during a transition without class conflicts.

The cost is maintaining two lines for a while, so we limit that period and backport only fixes, not features.

3Option 2: Remove Jackson Types From Library APIs

The better long-term answer is to stop exposing Jackson at all. A library API that takes a String, a byte array, or the company's own types is independent of the JSON library. The library still uses Jackson internally, but which major version it uses becomes an implementation detail that consumers never see.

Java
// Shared library, version 6.x: no Jackson types in the API
public interface EventPublisher {
void publish(String topic, Object event); // library serializes with its configured mapper
void publishRaw(String topic, byte[] json); // already serialized by the caller
}
public interface EventHandler<T> {
Class<T> type(); // the library deserializes for us
void handle(T event);
}
Ways to shape a shared library API
API shapeCoupling to JacksonCost
Takes and returns JsonNode or ObjectMapperSame major version forced on all usersLock-step upgrades
Parallel artifacts per Jackson versionEach user picks oneTwo lines to maintain for a while
Strings, bytes or own types onlyNone visibleOne-time API change
Removing Jackson from the API is the change that prevents the next lock-step move.

Notice that the new API is also easier to use: callers no longer build trees by hand. Where a library truly needs a flexible document, for example a generic metadata field, a Map<String, Object> or its own small value type is still better than a JsonNode, because it carries no version of anything.

4Sequencing the Migration

The order matters because services cannot move before the libraries they use. First we inventory: which libraries expose Jackson types, and which services use which library versions, generated from build files rather than asked by email. Then the shared libraries move first, each releasing a version that either has no Jackson types in its API or supports Jackson 3. Ideally that version also works on Spring Boot 3, for example by hiding Jackson behind the API, so services can adopt it before their own upgrade. Finally services upgrade to Spring Boot 4 at their own pace, which brings Jackson 3.

Step throughOrder of the Jackson 3 transition
  1. Inventory libraries and consumersWho exposes Jackson types, who uses them
  2. Release library versions without Jackson in the APIWork on Boot 3 and Boot 4
  3. Services adopt the new library versionsStill on Boot 3, small change
  4. Services upgrade to Boot 4 and Jackson 3Golden tests on payloads
  5. End date for Jackson 2 library linesRemove parallel artifacts

5 steps in order. Play them, or step through them one at a time.

Libraries first, services second, and the old line closes on a known date.

5Contract Tests on Message Formats

Moving to Jackson 3 can change JSON output through changed defaults, and a library change can change it through a different internal mapper. Either would silently change messages that other services read. So each shared library ships contract tests: for every event type and client call it owns, a golden file of the exact JSON, checked in its own build against both supported Jackson versions. Producing services add the same tests for their own events. If a default change turns an ISO date into a number or drops a null field, the test fails before any consumer sees it.

6Tracking Progress and Ending Jackson 2

A programme across 120 services needs visibility. A dashboard generated from the dependency inventory shows each service's Spring Boot version, Jackson major version and library versions, so we see at a glance who is blocked and by what. The platform team helps teams that are stuck, often by fixing the library that blocks them. We announce an end date for the Jackson 2 library lines, for example twelve months after the Jackson 3 versions ship, after which they receive security fixes only, and later nothing. Without an end date, the last ten services will stay on the old line for years and the parallel artifacts will never go away.

7Follow-up questions

Can't we just shade Jackson 2 inside the libraries?

Shading, copying Jackson into the library under a renamed package, hides the version from consumers, but it only works if Jackson types are not in the API, and then we have already done the important part. It also hides security fixes, because the shaded copy must be updated by rebuilding the library, so I would avoid it.

What about libraries from outside the company that expose Jackson 2 types?

We wrap them in a thin internal adapter that converts to our own types, or wait for their Jackson 3 release. The adapter is worth it when many services use the library, because it gives us one place to switch versions later.

How long should the transition take?

It depends on the number of libraries and how many services are actively maintained, but a plan of roughly a year, with libraries in the first quarter and services spread over the rest, is realistic. The end date matters more than the exact length, because it is what moves the last services.

8Conclusion

In this answer, we saw that Jackson types in shared library APIs force all consumers to change Jackson versions together. We published library versions that support Jackson 3, possibly as parallel artifacts, removed Jackson types from library APIs in favour of Strings, bytes and our own types, sequenced the work with libraries first and services second, protected message formats with contract tests, and tracked progress per service with an end date for Jackson 2.

What to say in the interviewAbout 90 seconds aloud

Open with

The core problem is that Jackson types in a library's public API make every consumer use the same Jackson major version. tools.jackson JsonNode and com.fasterxml JsonNode are different classes, so a service on Spring Boot 4 cannot call a library method that takes the Jackson 2 type, and 120 services would be forced to move in lock-step.

Then, if they want more

So I would first inventory which libraries expose ObjectMapper, JsonNode or Jackson exceptions and which services use them. Then the libraries move first. Where I can, I remove Jackson from the API entirely: take an Object or a byte array, return the caller's own types, let the library deserialize with a Class or handler type.

That makes the Jackson version an internal detail and prevents the same problem at the next major version. Where that is too big a change, I publish a parallel artifact or a new major line for Jackson 3, which works because both versions can coexist.

Services then adopt the new library versions, ideally still on Boot 3, and upgrade to Boot 4 at their own pace. Contract tests on message formats run for both Jackson versions so default changes cannot silently change payloads. And I track every service on a dashboard and set an end date for the Jackson 2 lines.

About this answer

Last updated
12 November 2026
Versions it names
Spring Boot 4, 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.
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 "Shared libraries in your company expose Jackson 2 types (ObjectMapper parameters...": https://scrivio-interview-library.netlify.app/spring-boot/json-serialization/360fa5d002/