I have some JSON with a handful of integer array variables, like so:
{"a": [8, 6, 2], "b": [2, 2, 1]}
I would like to use boost property_tree, for instance:
std::stringstream ss;
boost::property_tree::ptree pt;
ss << "{\"a\": [8, 6, 2], \"b\": [2, 2, 1]}";
boost::property_tree::read_json(ss, pt);
std::vector<int> a = pt.get<std::vector<int> >("a");
This doesn't work, nor does any variation on an int pointer that I've tried. How may I read an array from a property tree?