The Java JSON serializer emits extensions using their short names here:
|
generator.print("\"" + field.getName() + "\":" + blankOrSpace); |
For example, an extension foo.bar will be emitted as "bar": "value" instead of "[foo.bar]": "value".
The resulting JSON is unparseable in any language, unless the extension's short name happens to clash with another field name. In that case it will result in silent data corruption. It can also lead to JSON with duplicate keys (i.e. data loss) if two extensions have the same short name.
As of 35.0 this has a fix that can be opted into by calling printingFullyQualifiedExtensionNames(). But it can't be enabled by default without a breaking change
The Java JSON serializer emits extensions using their short names here:
protobuf/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
Line 1175 in 382f6a7
For example, an extension
foo.barwill be emitted as"bar": "value"instead of"[foo.bar]": "value".The resulting JSON is unparseable in any language, unless the extension's short name happens to clash with another field name. In that case it will result in silent data corruption. It can also lead to JSON with duplicate keys (i.e. data loss) if two extensions have the same short name.
As of 35.0 this has a fix that can be opted into by calling
printingFullyQualifiedExtensionNames(). But it can't be enabled by default without a breaking change