3
当我使用int的put_value
时,它会被写为字符串。有谁知道如何让它打印为int?如何获得提升json使用正确的数据类型
#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()'和'int main(int argc,char * argv [])'符合标准。 – 2015-03-24 22:06:31
@NeilKirk你为什么评论这个? – sehe 2015-03-24 23:53:26
@sehe因为他的主要不符合标准? – 2015-03-25 04:57:26