bivas / protobuf-java-format

Provide serialization and de-serialization of different formats based on Google’s protobuf Message. Enables overriding the default (byte array) output to text based formats such as XML, JSON and HTML.
BSD 3-Clause "New" or "Revised" License
153 stars 97 forks source link

JsonFormat.merge throw a exception when a 'message' field in json is null #58

Open haoyanzhang opened 3 years ago

haoyanzhang commented 3 years ago

message A { //xxx } message B { optional A a=0; }

B.Builder builder = B.newBuild(); new JsonFormat().merge("{a: null}", ExtensionRegistry.getEmptyRegistry(), builder);

Will throw exception like Exception in thread "main" com.googlecode.protobuf.format.JsonFormat$ParseException: 1:13: Expected "{"

version 1.4

harrylee2015 commented 2 years ago

这个问题你解决了吗?是不是要换低版本包,我可能也遇到同样问题了,json转proto报一样的错误