如何使用boost::property_tree表示JSON数组
2016-04-15 12:11
841 查看
创建JSON数组:
boost::property_tree::ptree array;
array.push_back(std::make_pair("", "element0"));
array.push_back(std::make_pair("", "element1"));
boost::property_tree::ptree props;
props.push_back(std::make_pair("array", array));
boost::property_tree::write_json("prob.json", props);
遍历数组:
BOOST_FOREACH(const boost::property_tree::ptree::value_type &v, array)
{
// v.first is the name of the child.
// v.second is the child tree.
}
boost::property_tree::ptree array;
array.push_back(std::make_pair("", "element0"));
array.push_back(std::make_pair("", "element1"));
boost::property_tree::ptree props;
props.push_back(std::make_pair("array", array));
boost::property_tree::write_json("prob.json", props);
遍历数组:
BOOST_FOREACH(const boost::property_tree::ptree::value_type &v, array)
{
// v.first is the name of the child.
// v.second is the child tree.
}
相关文章推荐
- 《Servlet与JSP核心编程》读书笔记
- javascript函数声明和函数表达式的区别
- JSP使用ajaxFileUpload.js实现跨域问题
- Javascript 变量作用域 缩写词 及两种定义的区别
- phantomjs 中如何使用xpath
- angular.js 国际化模块 angular-translate 简单方便快捷翻译中英文等多语言环境
- 64、JS解析JSON字符串
- 原生js团购-限时购
- JavaScript中的事件代理
- js 引号问题
- json解析和构建
- ArcGIS Server开发教程系列(8)ArcGIS API for Javascript-控件(小部件)(续)纯代码
- ArcGIS Server开发教程系列(8)ArcGIS API for Javascript-控件(小部件)
- ArcGIS Server开发教程系列(7)使用ArcGIS API for Javascript-Hello World
- pjsip(2.4.5)增加视频功能
- JavaScript核心对象参考手册-------window对象
- JS--DOM初相识
- 因浏览器而异的空白节点(js清除空白节点)
- js中confirm()函数的用法
- 说说JSON和JSONP,也许你会豁然开朗