Quick revision
The short answer
Yes, I would standardise, but per platform rather than for the whole company: Jackson for server-side Java because it is what Spring Boot uses, and a deliberate, documented choice for Android if Jackson does not fit there. Five libraries mean five streams of security advisories, different JSON for the same types and more to learn. I would govern it with a dependency BOM, build rules that flag non-standard libraries in new code and a shared configuration module, migrate stable code only when it is touched, and keep the wire format in schemas so no library defines it.
What to remember
In this answer, we treated the five JSON libraries as a cost in security tracking, wire format consistency and onboarding. We standardised per platform, with Jackson tied to the Spring Boot baseline on the server and a documented choice for Android, and we governed it with a BOM, build rules that warn before they fail, and a shared configuration module. We migrated by priority instead of rewriting, starting with public boundaries and untrusted input, and we moved the definition of the format into schemas so that the library choice stops defining the contract.
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.
Yes, I would standardise, but per platform rather than for the whole company: Jackson for server-side Java because it is what Spring Boot uses, and a deliberate, documented choice for Android if Jackson does not fit there. Five libraries mean five streams of security advisories, different JSON for the same types and more to learn. I would govern it with a dependency BOM, build rules that flag non-standard libraries in new code and a shared configuration module, migrate stable code only when it is touched, and keep the wire format in schemas so no library defines it.
Why this question is asked
A question like this is less about JSON than about how a senior engineer handles technical sprawl across many teams. Nobody chose to have five JSON libraries; they arrived one dependency at a time. Interviewers want to hear whether we can put a cost on that sprawl, avoid a rewrite programme nobody needs, and set up rules that keep working after the meeting is over. In this answer, we will look at what the sprawl actually costs, decide what the standard should be and why it differs by platform, design the governance that enforces it, plan the migration, and finally separate the wire contract from the library choice.
1What Five Libraries Actually Cost
Start with security. Each library has its own advisories, its own release cadence and its own history; Jackson databind, for example, had a long run of deserialization advisories around polymorphic typing. With five libraries across 200 services, the security team must track five feeds and find every service that uses each vulnerable version. When one advisory appears, the question 'are we affected?' takes days instead of minutes.
Next comes the wire format. The same Java type produces different JSON in different libraries: Gson omits nulls and Jackson includes them, dates come out as numbers in one and ISO strings in another, and BigDecimal may be printed differently. When two services exchange an Order type serialized by two libraries, small differences become bugs that only appear in integration.
Finally, people. Each library has its own annotations and configuration, so an engineer moving between teams relearns how to rename a field or ignore a property. That cost is small per person but real across hundreds of engineers.
| Library | Typical use | Main concern |
|---|---|---|
| Jackson 2 | Spring Boot 3 services | the de facto standard, but version drift between services |
| Jackson 3 | Spring Boot 4 services | new packages (tools.jackson), mixed with Jackson 2 in one estate |
| Gson | Android apps, older clients | different null and field rules from Jackson |
| JSON-B | Jakarta EE runtimes | fine inside the runtime, odd one out elsewhere |
org.json | small utilities | no data binding, unordered keys, licence questions |
2Choosing the Standard, Per Platform
For server-side Java the choice is almost made for us. Spring Boot auto-configures Jackson, its HTTP message converters, its test slices and its documentation all assume it, and the rest of the ecosystem, from OpenAPI generators to Kafka serializers, supports it first. Choosing anything else would mean fighting the main framework. The real decision is the Jackson major version: Spring Boot 4 moves to Jackson 3, so the standard should say 'Jackson, at the version our Spring Boot baseline ships', and the Jackson 2 to 3 move follows the Boot upgrade rather than being a separate project.
Android is a different platform with different constraints: app size, startup time and code shrinking. Many Android teams use kotlinx.serialization or Moshi, and Gson is common in older apps. I would not force Jackson onto the apps just for uniformity. Instead, the mobile team makes its own documented choice, and the thing we standardise across both platforms is the wire contract, which we come back to at the end.
Jakarta EE services running on an application server may keep JSON-B, because the runtime supplies it and it is the portable API there. org.json has no good reason to stay in new code, and Gson on the server side should be phased out as code is touched.
3Governing It So the Rule Holds
A standard that lives only in a wiki page decays within a year. The rule has to be part of how services are built.
The first tool is a company BOM, a bill of materials that fixes the versions of shared dependencies. Services import it, so they all get the same Jackson version and one upgrade PR updates the whole estate. The second tool is a build rule, such as the Maven Enforcer bannedDependencies rule or a Gradle dependency constraint, that flags Gson, org.json and JSON-B in server-side modules. For existing services the rule starts as a warning, with an allowlist of known uses, and becomes an error only for new services and new modules. The third tool is a shared configuration module or starter that configures the ObjectMapper the company way: ISO dates, the inclusion rule, the unknown-property policy. That way the standard covers behaviour, not just the dependency name.
Notice that the rule is a guardrail, not a punishment. A team that has a real reason, such as a library that only exposes Gson types, asks for an exception, and the exception is recorded with an owner and a review date.
4Migrating Without a Rewrite Programme
The worst outcome would be a mandate to rewrite 200 services. Stable code that serializes internal objects with Gson and has not changed in two years is cheap to leave alone, and a rewrite carries the exact risk we are trying to remove: silent changes in the wire format.
So migration follows two priorities. The first is public boundaries, such as public APIs and messages consumed by other teams, because that is where format differences hurt most and where one shared configuration gives the most consistency. The second is security-sensitive parsing, meaning code that reads untrusted input, because that is where an unmaintained or misconfigured library is most dangerous. Everything else migrates when a team touches the code for another reason. Each migration starts with contract tests that capture today's JSON, so the switch is proven not to change the output.
To keep this honest, we track the number of services using each library on a dashboard built from the dependency scans we already run. If the count goes down each quarter, the policy works.
- Does the code parse untrusted input?YesMigrate soon, with tests firstNoNext question
- Is the JSON part of a public or shared contract?YesMigrate with contract testsNoNext question
- Is the team changing this code anyway?YesMigrate as part of the changeNoLeave it, keep it on the allowlist
3 steps in order. Play them, or step through them one at a time.
5Keeping the Contract Out of the Library
The deepest fix is to stop letting any library define our JSON. If the format of an Order is written down in an OpenAPI document or a JSON Schema, then Jackson on the server, Moshi on Android and JSON-B on the application server all have one target to match, and contract tests check each of them against it. A library switch then becomes an implementation detail that tests can verify, rather than a change in behaviour that customers discover.
This is also the argument that convinces product owners. The standard does not exist for tidiness; it exists so that a security advisory can be answered in an hour and a library upgrade cannot quietly break a partner integration.
6Follow-up questions
Would you allow Android to keep Gson?
For existing apps, yes, as long as the JSON it produces matches the schema. For new Android code, I would ask the mobile team to pick a library that suits Android, often kotlinx.serialization or Moshi, and document why. Uniformity across platforms is worth less than a good fit on each platform, provided the wire format is shared.
How do you handle Jackson 2 and Jackson 3 living side by side?
I tie the Jackson major version to the Spring Boot baseline: Boot 3 services stay on Jackson 2 and Boot 4 services use Jackson 3. Jackson 3 uses new package names for the core and databind classes, so both can technically exist on one classpath, but I would avoid that inside one service. Shared libraries should keep their public types free of Jackson annotations where possible so they work with both.
How do you measure whether the standard is worth it?
I would track the number of services per JSON library, the time it takes to answer 'are we affected?' for a JSON advisory, and the number of integration incidents caused by format differences. If those numbers fall, the standard is paying for itself.
7Conclusion
In this answer, we treated the five JSON libraries as a cost in security tracking, wire format consistency and onboarding. We standardised per platform, with Jackson tied to the Spring Boot baseline on the server and a documented choice for Android, and we governed it with a BOM, build rules that warn before they fail, and a shared configuration module. We migrated by priority instead of rewriting, starting with public boundaries and untrusted input, and we moved the definition of the format into schemas so that the library choice stops defining the contract.
Open with
I would standardise, but per platform. On the server side the answer is Jackson, because Spring Boot is built around it, and I would tie its major version to our Boot baseline so the move from Jackson 2 to Jackson 3 happens with the Boot 4 upgrade rather than as a separate project.
Then, if they want more
For Android I would let the mobile team make a documented choice, since app size and startup matter there and Jackson is not always the best fit.
The reasons to standardise are concrete: every library is another stream of security advisories to track across 200 services, the same type serializes differently in Gson and Jackson so integrations break in subtle ways, and engineers relearn annotations when they change teams.
To govern it I would use a company BOM so every service gets the same version, an enforcer or Gradle rule that warns on Gson, org.json and JSON-B in server code and fails only in new modules, and a shared starter that configures the mapper the same way everywhere. I would not mandate rewrites.
Stable code stays until someone touches it, and I would migrate first where it matters: public APIs and code that parses untrusted input, always with contract tests that capture today's JSON before the switch.
Finally, I would move the definition of our JSON into OpenAPI or JSON Schema, so the library becomes an implementation detail and any future switch is a tested change, not a surprise.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 4
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. 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 "Your company has Gson, Jackson 2, Jackson 3, JSON-B and org.json across 200 services and...": https://scrivio-interview-library.netlify.app/java/json-libraries/68b68d1422/