BOOST关于json的一些问题
爱奇途 2011-06-30 04:46:15 string s = "{\"age\" : 26,\"study\":{\"language\":{\"one\":\"chinese\",\"two\":\"math\"},\"fee\":500,\"subject\":[{\"one\":\"china\"},{\"one\":\"Eglish\"}]},\"person\":[{\"id\":1,\"name\":\"chen\"},{\"id\":2,\"name\":\"zhang\"}],\"name\" : \"huchao\"}";
ptree pt;
stringstream stream(s);
read_json<ptree>( stream, pt);
string s1=pt.get<string>("age");
cout<<s1<<endl;
string s2=pt.get<string>("name");
cout<<s2<<endl;
// pt.put_child("study",400);
string s3=pt.get_child("study").get_child("language").get<string>("two");
cout<<s3<<endl;
现在问题是我可以读出study->language->two的值,但是我现在怎么通过boost的ptree方法修改值??
望高手指导下!