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