C++: How to create an array using boost::property_tree?
问题 I don't see a way to create an array using boost::property tree. The following code ... #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <iostream> int main() { try { boost::property_tree::ptree props; props.push_back(std::make_pair("foo", "bar")); props.push_back(std::make_pair("foo", "baz")); boost::property_tree::write_json("prob.json", props); } catch (const std::exception & ex) { std::cout << ex.what() << std::endl; } } ... just gives me ..