16,548
社区成员




#include "stdafx.h"
#include <iostream>
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp>
using namespace std;
using namespace boost::property_tree;
int _tmain(int argc, _TCHAR* argv[])
{
printf("hello word..\n");
ptree pt_1,pt_11,pt_12;
pt_11.put("id","3445");
pt_11.put<int>("age",29);
pt_11.put("name","chen");
pt_12.push_back(make_pair("",pt_11));
pt_12.push_back(make_pair("",pt_11));
//replace or create child node "data"
pt_1.put_child("data",pt_12);
ostringstream os;
write_json(os,pt_1);
cout<<os.str()<<endl;
return 0;
}