SIGN IN SIGN UP

Protocol Buffers - Google's data interchange format

0 0 50 C++

Add option to enable strict JSON parsing in Protobuf Java JsonFormat.

JsonFormat used 'reader.setLenient(false)' to try to get spec JSON behavior out of GSON. However, this mode was still not actually spec JSON. In ~2024 GSON deprecated setLenient(), made that behavior LEGACY_STRICT and added a new level STRICT which is intended to be spec.

Switching unilaterally would be a breaking change for Protobuf: this change just adds the option for users to ask us to use GSON in strict mode. At a later date we will consider flipping the default of this (letting people opt into LEGACY_STRICT if they want to).

PiperOrigin-RevId: 921432331
P
Protobuf Team Bot committed
40825a1df7f87857560a03bf901fdd7649930010
Parent: 4376cba
Committed by Copybara-Service <copybara-worker@google.com> on 5/26/2026, 1:39:41 PM