我最终在我的工具中添加了另一个功能来解决此问题:
#include <string>#include <regex>#include <boost/property_tree/json_parser.hpp>namespace bpt = boost::property_tree;typedef bpt::ptree JSON;namespace boost { namespace property_tree { inline void write_jsonEx(const std::string & path, const JSON & ptree) { std::ostringstream oss; bpt::write_json(oss, ptree); std::regex reg("\"([0-9]+\.{0,1}[0-9]*)\""); std::string result = std::regex_replace(oss.str(), reg, "$1"); std::ofstream file; file.open(path); file << result; file.close(); }} }希望有帮助。



