Opened 10 years ago
Closed 8 years ago
#7088 closed Bugs (invalid)
Error with property_tree
| Reported by: | Owned by: | Sebastian Redl | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | property_tree |
| Version: | Boost 1.50.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
json {
cool : hp
}
I have Simple example: typedef boost::property_tree::basic_ptree< string_t, string_t > ptree; boost::property_tree::json_parser::read_json("path_out", pt); ptree pt;
auto result = pt.get_child(_T("cool")); result.add(_T(" "), _T("33333"));
std::for_each(result.begin(), result.end(), [&](ptree::value_type const& val) {
std::wcout << val.first << _T(" ") << val.second.data() << std::endl;
});
pt.put_child(_T("cool"), result); boost::property_tree::json_parser::write_json("path_out", pt);
i have:
json {
cool :
{
"": "hp", " ": "33333"
}
}
Why. I need array
Change History (2)
comment:1 by , 10 years ago
| Component: | None → property_tree |
|---|---|
| Owner: | set to |
comment:2 by , 8 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |

All keys must be empty for the node to be treated as an array. In your case, your key is a single space.