Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Some teams want to replace JSON with Protobuf or Avro for internal traffic. How would you decide on wire formats for the company over the next decade?

JSON is readable, universal and needs no special tooling, while binary schema-based formats such as Protobuf and Avro are smaller, faster to parse, and come with compatibility rules that make evolution safer. I would choose by use case: JSON for public APIs and most low-volume traffic, a binary format where internal volume or contract discipline justifies it. Each format needs tooling, schema registries and skills, so the company should support a small, deliberate set rather than whatever each team prefers.

Why this question is asked

A wire format decision outlives the people who make it. Once hundreds of services and years of stored events use a format, changing it costs more than almost any library upgrade. Interviewers ask this at senior levels because the answer shows whether we can weigh technical gains against the cost of running a platform across many teams. In this answer, we will recap what the formats actually are, compare them honestly, look at what schema-based evolution buys us, decide by use case with a worked example, and finish with how a company keeps the set of formats small over a decade.

1A Quick Recap of the Three Formats

JSON is text. A message carries every field name alongside its value, and any language can read it with a standard library. We can read it in a log, paste it into a terminal, and debug it with curl.

Protobuf, short for Protocol Buffers, is a binary format. We describe messages in a .proto file, generate classes from it, and each field is written as a small numeric tag plus its value. Field names never travel on the wire, which is why messages are small. Avro is also binary and schema-based, but it writes no tags at all: the reader needs the writer's schema to decode the bytes, which is why Avro is almost always used with a schema registry, a service that stores every schema version and hands out an id that travels with each message.

So the basic trade is visible already. JSON describes itself; the binary formats rely on a schema that both sides share.

2Comparing Size, Speed and Readability

Binary formats are smaller and faster, but the gap depends on the data. For a typical event of twenty fields, a Protobuf encoding is often several times smaller than the same JSON, and parsing is noticeably cheaper because there is no text to scan and no field names to match. After compression the size gap narrows, since repeated field names compress very well. We should measure with our own messages before quoting numbers in a decision document.

JSON compared with schema-based binary formats
ConcernJSONProtobuf or Avro
Readable by humansYes, in logs and toolsNo, needs a decoder and the schema
Size on the wireLarger, field names repeatedSmaller, tags or no names at all
Parse costHigher, text scanningLower, binary decoding
SchemaOptional (JSON Schema, OpenAPI)Required, source of generated code
Evolution rulesBy convention and disciplineDefined compatibility rules, checkable
Tooling neededNone beyond a JSON libraryCode generation, registry, plugins
Public clientsExpected by almost everyoneRare outside gRPC ecosystems
The binary formats win on volume and discipline; JSON wins on reach and simplicity.

3What Schema-Based Evolution Really Buys Us

The strongest argument for Protobuf and Avro is not speed; it is evolution with rules. In Protobuf, a field number never changes meaning, new fields are added with new numbers, and old readers skip tags they do not know. In Avro, a schema registry can be configured to refuse a new schema version that is not backward compatible, for example one that adds a required field without a default. The check runs when a producer registers the schema, before any consumer sees a bad message.

With JSON we can reach similar safety, but only through discipline: tolerant readers, contract tests, and review of every change. That works in a good team and fails quietly in a busy one. So when someone proposes a binary format, the real question to ask is whether we have contract problems that machine-checked compatibility would solve, or only a performance wish.

4Deciding by Use Case

Let us take a concrete situation. The company has a public REST API used by partners, about 200 internal services calling each other over HTTP with JSON, and a Kafka platform carrying 3 billion events a day, mostly from five high-volume producers. The payments team proposes moving everything to Protobuf.

For the public API, JSON stays. Partners expect it, browsers read it, and the volume is modest. For most internal synchronous calls, JSON is fine as well: the cost of parsing a few kilobytes is tiny compared with the network and database time of the call. For the high-volume Kafka topics, a binary format with a registry pays off: at billions of events a day, a several-fold size reduction lowers broker storage, network and consumer CPU, and the registry's compatibility checks protect dozens of consuming teams. For internal synchronous traffic with strict latency needs, gRPC with Protobuf is a reasonable option where a team can show the benefit.

Step throughChoosing a wire format for a new interface
  1. Is it a public or partner API?
    YesJSON with OpenAPINoContinue
  2. High volume or long-lived stored data?Billions of messages, years of retention
    YesBinary with schema registryNoContinue
  3. Strict latency between internal services?
    YesgRPC with Protobuf, if measuredNoJSON over HTTP
  4. Record the choiceFormat, schema location, compatibility rule

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

A short decision path that keeps JSON as the default and binary formats as a justified choice.

5Keeping the Set of Formats Small

Each format brings real costs: code generation in the build, a schema registry to run and secure, debugging tools that can decode messages, libraries for every language the company uses, and people who understand the evolution rules. If three teams adopt Protobuf, two adopt Avro and one adopts MessagePack, we pay all of those costs several times and lose the ability to move engineers and tools between teams.

So the decision for the decade is a short list, for example JSON as the default everywhere and one binary format, say Avro or Protobuf, chosen once for event streams and high-volume links. A platform team owns the registry, the build plugins and a decoder in the internal tooling so that a binary message is as easy to inspect as JSON. We write the rules down in an architecture decision record, review new formats through the architecture group, and revisit the choice every few years with measurements rather than preferences. Migration happens per topic or per interface, with dual publishing during the transition, never as a big bang.

6Follow-up questions

Would you choose Avro or Protobuf for Kafka?

Both work. Avro fits well when the company already runs a schema registry and wants compatibility checks per subject and dynamic schemas for data pipelines. Protobuf fits well when the same messages also travel over gRPC and teams want generated classes with a familiar tooling story. I would pick the one that matches existing skills and tooling, and then use only that one for event streams.

How do you debug binary messages in production?

With tooling that the platform provides: a command-line or web consumer that fetches the schema from the registry and prints messages as JSON, log statements that render the decoded object rather than bytes, and dead-letter topics that keep the original bytes plus the schema id. Without such tools, teams lose the main practical advantage of JSON and will resist the change.

Is JSON Schema enough to get the evolution benefits?

Partly. JSON Schema can describe and validate messages, and some registries support it with compatibility checks. But JSON Schema compatibility is harder to define than for Protobuf or Avro, and many teams do not validate at runtime. It is a good step for JSON-based events, not an equal replacement for a binary format with enforced rules.

7Conclusion

In this answer, we saw that JSON is readable and universal, while Protobuf and Avro are smaller, faster and schema-based, with compatibility rules that make evolution safer. We chose by use case, JSON for public APIs and most internal calls, binary formats for high-volume and long-lived event streams, and we kept the company's set of formats small because every format needs tooling, registries and skills.

What to say in the interviewAbout 80 seconds aloud

Open with

I would not make this a company-wide replacement of JSON. JSON is readable, universal and needs no tooling, which is exactly what partners and most internal HTTP calls need.

Then, if they want more

Protobuf and Avro are smaller and faster to parse, and more importantly they are schema-based, with compatibility rules a registry can enforce before a bad message ever reaches a consumer. So I decide by use case. Public APIs stay JSON with OpenAPI.

Internal synchronous calls stay JSON unless a team shows a latency need, in which case gRPC with Protobuf is fine. High-volume event streams, say billions of Kafka messages a day or data we keep for years, move to one binary format with a schema registry, because the storage, network and CPU savings and the compatibility checks pay for themselves there.

Every format costs tooling, code generation, a registry to run and people who understand the rules, so I would support a short list, JSON plus one binary format, owned by a platform team that also gives us decoders for debugging.

The decision goes into an architecture decision record, migrations happen per topic with dual publishing, and we revisit the list every few years based on measurements.

About this answer

Last updated
12 November 2026
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 "Some teams want to replace JSON with Protobuf or Avro for internal traffic. How would...": https://scrivio-interview-library.netlify.app/spring-boot/json-serialization/0dd638225f/