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
Post a Comment