protocolbuffers / protocolbuffers/protobuf
Feature request: option for JsonFormat.Printer to fail if unknown fields are encountered
@esrauchg is already working on this.
Since Jul 30, 2026.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
Currently, com.google.protobuf.util.JsonFormat.Printer silently ignores unknown fields. It would be nice to have a proactive safety check that would fail if the passed in MessageOrBuilder had unknown fields. Ideally, this would apply recursively to any nested messages, and also account for unknown fields in well known message types as well.
While encountering an unknown fields at this layer is most likely an application-level error (that is, the application probably deserialized some binary data without checking if there were any unknown fields, and then later on decided to serialize it as JSON), it would be nice to have a built-in option for this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.