admin 管理员组文章数量: 1087139
2024年4月13日发(作者:html5canvas3d相册)
18: {
19: cout << "parse error" << endl;
20: return -1;
21: }
22:
23: string name = tempVal["name"].asString();
24: string sex = tempVal["sex"].asString();
25: string age = tempVal["age"].asString();
26:
27: Json::Value friends = tempVal["friends"];
28: for(int i = 0;i < ();i++)
29: {
30: cout << friends[i]["name"].asString() << endl;
31: }
32:
33: cout << "name = " << name << " age = " << age << " sex = " << sex << " friendsName " << friendsName < 34: 35: delete pJsonParser; 36: 37: return 0; 38: } 39: 1: #include 2: #include 3: #include "json/json.h" 4: using namespace std; 5: 6: int main() 7: { 8: Json::Value root; 9: Json::FastWriter writer; 10: Json::Value person; 11: 12: person["name"] = "hello world"; 13: person["age"] = 100; 14: (person); 15: 16: std::string json_file = (root); 17: 18: 19: ofstream ofs; 20: (""); 21: assert(_open()); 22: ofs< 23: 24: return 0; 25: }
版权声明:本文标题:C++json库jsoncpp吐槽(转) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1713017198a617371.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论