Protocol buffer3 and json
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Protocol buffer v3 claims, that library is json friendly ( https://developers.google.com/protocol-buffers/docs/proto3#json ), but I cannot find how to achieve get that mapping. Should I add some plugin, or some option into protoc, or call something special instead SerializeTo/ParseFrom? Is it someone who use that feature? 回答1: I'm using Protobuf 3.3.0, which does have a built-in JSON serializer and parser. You can use 2 functions from google/protobuf/util/json_util.h called MessageToJsonString() and JsonStringToMessage() to make your C++