Json::Value root;
Json::Value arrayObj;
Json::Value item;
for
(int i=0; i<10; i++)
{
item["key"] = i;
item["value"] =
10*i;
arrayObj.append(item);
}
root["key1"] = "value1";
root["key2"] = "value2";
root["array"] =
arrayObj;
root.toStyledString();
std::string out =
root.toStyledString();
std::cout << out << std::endl;
jsoncpp 生成 json 字符串,布布扣,bubuko.com
原文:http://www.cnblogs.com/shanguanghui/p/3597187.html