需要添加的头文件

#include <google/protobuf/message.h>
#include <google/protobuf/util/json_util.h>
#include <google/protobuf/text_format.h>

json串与protobuf的message互转

// json-string 转 protobuf message
util:Status google::protobuf::util::JsonStringToMessage(const std::string content, google::protobuf::Message* message);

// protobuf 转 json-string
util:Status google::protobuf::util::MessageToJsonString(const google::protobuf::Message& message, std::string* str );

GitHub 加速计划 / js / json
41.72 K
6.61 K
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:16 天前 )
960b763e 3 个月前
8c391e04 5 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐