// 以下涉及json的操作,将在后文中涉及,此处为简单应用,不解释,你懂的 Reader reader; string test2 = "{\"filenamelist\":[" "[\"a.txt\",\"b.txt\",\"c.txt\"],[\"b.txt\",[\"c.txt\",\"c.txt\"]]}"; Value value; if(!reader.parse(test2,value)) { cout<<"Failed"<<endl; } else { cout<<"succeddful"<<endl; } cout<<value<<endl; cout<<value["filenamelist"]<<endl; cout<<value["filenamelist"].size()<<endl; //Json::Value::Members member; const Json::Value arrayObj = value["filenamelist"]; const Json::Value plugins = value["filenamelist"]; int index = 0; cout<<arrayObj[index][index]<<endl; //cout<<arrayObj[0][0]<<endl;
arryObj的索引下标必须使用变量,不能使用具体的数字
原文链接:https://www.f2er.com/json/290634.html