When I put_value
using an int, it gets written as a string. Does anyone know how to get it to print as an int?
#include <iostream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
using boost::property_tree::ptree;
using namespace std;
int main(int argc, char* argv[]) {
ptree node;
node.put("string", "text here");
node.put("int", 1);//outputs as "1" and should be 1
write_json(cout, node, false);//{"string":"text here","int":"1"}
return 0;
}
int main()
andint main(int argc, char * argv[])
are standard-conforming. – Clayberg