TECHNOLOGY

A Protobuf JSON round trip can lose unknown fields

In this article
THE QUICK TAKE

Review every representation and copy boundary in a forwarding path; successful parsing does not prove that fields unknown to an older component survive the round trip.

Follow a new field through an older intermediary

A newer service adds provenance metadata to an analysis message. An older intermediary reads the message and forwards it to another service. The proto3 language guide says unknown binary fields are preserved in messages and included in serialized output. This supports a useful forwarding behavior, but only while the intermediary retains the relevant message representation and unknown-field data.

Locate the JSON conversion boundary

The guide explicitly identifies serialization to JSON as a way to lose unknown fields. The ProtoJSON specification does not provide the same unknown-field propagation guarantee as binary Protobuf. An intermediary that converts the message into JSON for logging, storage or a secondary API may therefore discard metadata its generated schema cannot describe. Later conversion back to binary cannot reconstruct fields that were already lost.

Distinguish permissive parsing from preservation

ProtoJSON parsers reject unknown fields by default and may offer an option to ignore them. Ignoring permits parsing to proceed; it does not imply that unknown properties are retained for a later serialization. Decide whether the intermediary is intended to understand a subset or transparently forward the whole message. A flag chosen to avoid parse errors can be appropriate for the former and incompatible with the latter.

Review copies as well as formats

The proto3 guide also warns that iterating fields to reconstruct a new message can lose unknown data. It recommends message-oriented copy or merge APIs rather than copying fields individually when retention matters. Progressive reading helps follow the actual adapter path, including apparently harmless conversion helpers. The preservation question belongs to the whole path, not merely to the first decoder that successfully accepted the incoming binary payload.

Assess compatibility at the consumer’s meaning

AIP compatibility guidance separates wire compatibility from semantic expectations. A final consumer may still parse the forwarded message while missing provenance it needs to explain an analysis. Tool observations should compare the relevant fields before and after the intermediary. This gives a concrete answer about forwarding behavior without presenting parser success, an ignore-unknown setting or a common serialization brand as proof that all newer metadata survived.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles