[property_tree] Json parser with invalid JSON string
13 Apr
2016
13 Apr
'16
2:36 p.m.
Hi all, I experience a strange behavior of parsing non-JSON data with JSON parser. I can create a property_tree from a simple non-JSON string, without exception. And serializing back the result throws : boost::property_tree::ptree m_tree; // Non-JSON to ptree using JSON parser std::istringstream is("1"); // Simple value, non-JSON boost::property_tree::json_parser::read_json(is, m_tree); // ==> No exception, I now have a valid ptree object. // ptree back to JSON std::ostringstream buf; boost::property_tree::json_parser::write_json(buf, m_tree, false); // ==> Exception How can I filter input values that will not be serializable later (= verify that input value is well JSON formatted) ? Thanks for your help, S. Gallou
3133
Age (days ago)
3133
Last active (days ago)
0 comments
1 participants
participants (1)
-
Sébastien Gallou