Scrivio Interview library
ConceptFoundations6 min read · updated 12 November 2026

What do backward and forward compatibility mean for events, and which changes to a JSON event are usually safe?

Backward compatible means new consumers can read old events; forward compatible means old consumers can read new events. Adding an optional field to a JSON event is usually safe in both directions, provided consumers ignore unknown fields and treat the new field as possibly missing, while removing a required field, renaming a field or changing its type breaks consumers. Because stored and replayed events can be read years later, backward compatibility has to hold for a long time.

Why this question is asked

Events outlive the code that wrote them. A consumer deployed today may read an event written last year from a long-retention topic, and an old consumer that has not been upgraded yet will read events from a producer deployed this morning. Interviewers ask about compatibility because it is the everyday skill of changing an event without breaking anyone. In this answer, we will define the two directions clearly with an example, see how Jackson in a Spring service handles unknown and missing fields, go through which JSON changes are safe and which are breaking, and look at why stored events make backward compatibility matter for so long.

1A Quick Recap: Two Directions of Compatibility

Imagine version 1 of OrderPlaced has orderId and total. We release version 2, which adds an optional field, channel. Now two situations happen at once during a rollout. A consumer already upgraded to v2 code reads an old v1 event, which has no channel. And a consumer still running v1 code reads a new v2 event, which has a channel it has never heard of.

Backward compatibility is about the first situation: new readers can read old data. Forward compatibility is about the second: old readers can read new data. The names are easy to mix up, so it helps to anchor them on the reader. Backward means the reader looks back at older events; forward means an old reader copes with events from the future.

Who reads what during a rollout
ReaderEventProperty needed
Consumer on v2 codeold v1 event, no channelbackward compatibility
Consumer on v1 codenew v2 event, with channelforward compatibility
Consumer on v2 codereplayed v1 event from 2024backward, for years
Both directions are needed while producers and consumers upgrade at different times.

2How a Spring Consumer Handles Unknown and Missing Fields

Most Java consumers turn JSON into objects with Jackson. Two behaviours decide compatibility. When the JSON has a field the class does not have, Jackson's DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES decides whether that is an error. Plain new ObjectMapper() fails by default. Spring Boot's auto-configured ObjectMapper disables this feature, and Spring Kafka's own JSON deserializer also uses a mapper that ignores unknown properties; check your versions, especially with Spring Boot 4, which moves to Jackson 3.

Java
record OrderPlacedV1(String orderId, long total) {}
String v2json = "{\"orderId\":\"o-7\",\"total\":4200,\"channel\":\"mobile\"}";
new ObjectMapper().readValue(v2json, OrderPlacedV1.class);
// UnrecognizedPropertyException: Unrecognized field "channel"
ObjectMapper tolerant = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
tolerant.readValue(v2json, OrderPlacedV1.class); // OrderPlacedV1[orderId=o-7, total=4200]

Notice that the same event breaks one consumer and not the other, depending only on mapper configuration. This is why tolerant reading, ignoring what we do not understand, is part of the contract for every consumer, and why we can also mark classes with @JsonIgnoreProperties(ignoreUnknown = true) so they do not depend on mapper settings.

The other behaviour is missing fields. When a v2 consumer reads a v1 event without channel, Jackson simply leaves channel as null (or the primitive default). The consumer code must treat it as optional: channel == null means 'unknown', not an error.

3Which JSON Changes Are Usually Safe

Adding an optional field is the standard safe change. Old consumers ignore it (forward compatible, if they are tolerant), and new consumers handle its absence in old events (backward compatible, if they treat it as optional). Adding a new value to an enum-like field is safe only if consumers have a default branch for unknown values; otherwise an old consumer meeting 'channel': 'kiosk' may fail.

Making a required field optional is safe for old producers' events, but old consumers that expect it to always be present may break when a new producer omits it, so in practice we keep populating it for a while.

Java
// v2 consumer handling an old event safely
record OrderPlaced(String orderId, long total, String channel) {
String channelOrUnknown() { return channel == null ? "unknown" : channel; }
}
// v1 event read by v2 code: channelOrUnknown() -> "unknown"
// v2 event read by v2 code: channelOrUnknown() -> "mobile"

4Which Changes Are Breaking

Removing a required field breaks old consumers that still read it: they get null where they never expected one, and backward compatibility for stored events also breaks if the new reader requires it. Renaming a field is a removal plus an addition, so it breaks both directions at once: old readers lose customerName, new readers do not find fullName in old events. Changing a type, such as total from a number 4200 to an object with value and currency, breaks every reader that expects the old type, since Jackson cannot turn an object into a long.

Changing the meaning of a field without changing its name is the most dangerous change of all, because nothing fails. If total silently changes from cents to euros, every consumer keeps working and every number is wrong by a factor of a hundred.

JSON event changes and their effect
ChangeOld consumersNew consumers on old eventsVerdict
Add optional fieldignore it if tolerantsee null, treat as optionalsafe
Add enum valuefail without a default branchfinesafe with care
Remove required fieldget null, may failfinebreaking
Rename fieldlose the old fieldmiss the new fieldbreaking
Change type (number -> object)parse errorparse error on old eventsbreaking
Change meaning, same namewrong results, no errorwrong resultsbreaking, silent

5Why Stored Events Keep Backward Compatibility Alive

With a short-lived queue, an old event disappears within minutes and backward compatibility only matters during the rollout. With Kafka topics kept for weeks or forever, compacted topics, event-sourced stores and data lakes, old events stay readable for years, and any consumer may replay them: a new projection built from the full history, or a service recovering from a bug.

So the newest consumer code must still read the oldest event that exists anywhere it might read from. That is why the rules for safe changes are strict for events, and why breaking changes are handled by introducing a new field or a new event type rather than changing the old one in place.

6Follow-up questions

Does a schema registry change any of this?

It enforces it. With Avro, Protobuf or JSON Schema in a registry such as Confluent Schema Registry or Apicurio, we set a compatibility mode per subject, for example BACKWARD or FULL, and the registry rejects a new schema version that breaks it. The definitions of safe changes stay the same; the registry simply checks them automatically.

What is full compatibility?

Full compatibility means a change is both backward and forward compatible, so any reader version can read any writer version. Adding an optional field with a default is the typical fully compatible change. Transitive variants check against all previous versions, not just the last one, which matters for long-lived stored events.

Why not just version the topic for every change?

Because each new topic or version forces every consumer to migrate. We keep that for genuinely breaking changes and use additive, compatible changes for everything else, which consumers can adopt at their own pace.

7Conclusion

In this answer, we saw that backward compatibility lets new consumers read old events and forward compatibility lets old consumers read new events, and that both matter during any rollout. Adding an optional field is usually safe as long as consumers ignore unknown fields, as Spring Boot's auto-configured mapper does, and treat new fields as possibly missing. Removing required fields, renaming and changing types are breaking, and changing meaning silently is worst. Because events are stored and replayed, backward compatibility must hold for as long as old events exist.

What to say in the interviewAbout 80 seconds aloud

Open with

Backward compatible means new consumers can read old events, and forward compatible means old consumers can read new events. During a rollout we need both, because producers and consumers upgrade at different times.

Then, if they want more

For JSON with Jackson, the safe change is adding an optional field. Old consumers ignore it as long as they are tolerant readers, meaning FAIL_ON_UNKNOWN_PROPERTIES is disabled, which Spring Boot's auto-configured ObjectMapper does, though a plain new ObjectMapper fails, so I would check the configuration or use JsonIgnoreProperties.

New consumers reading old events get null for the new field, so the code has to treat it as optional. Breaking changes are removing a required field, renaming, which is a removal plus an addition, and changing a type, like a number becoming an object. Changing what a field means without renaming it is the worst, because nothing fails.

Finally, events are often stored for a long time and replayed, so backward compatibility is not just a rollout concern: today's consumer must still read the oldest stored event, which is why breaking changes go into new fields or new event versions instead of being made in place.

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 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 "What do backward and forward compatibility mean for events, and which changes to a JSON...": https://scrivio-interview-library.netlify.app/spring-boot/event-driven-patterns/f8ebf7ce6a/