JSCONCPP
来源:互联网 发布:iphone5c支持4g网络吗 编辑:程序博客网 时间:2024/06/06 22:13
#include <json/json.h>
字符串转jscon
Json::Reader reader;
{
int code = root["code"].asInt(); // 访问节点,code = 100
}
jscon 到字符串
#include <json/json.h>
Json::Value root; // Json::Value是一种很重要的类型,可以代表任意类型。如int, string, object, array
root["date"] = "2011-11-11";
root["time"] = "11:11:11";
Json::FastWriter writer;
std::string strWrite = writer.write(root);
root["time"] = "11:11:11";
Json::FastWriter writer;
std::string strWrite = writer.write(root);
1 0