java - How to convert from Json to Protobuf? -


i'm new using protobuf, , wondering if there simple way convert json stream/string protobuf stream/string in java?

for example,

protostring = converttoproto(jsonstring) 

i have json string want parse protobuf message. so, want first convert json string protobuf, , call message.parsefrom() on it.

thanks in advance help!

with proto3 can using jsonformat. parses directly json representation, there no need separately calling mymessage.parsefrom(...). should work:

jsonformat.parser().merge(json_string, builder); 

Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

javascript - How to change image src on success AJAX -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -