diff options
Diffstat (limited to 'boost/property_tree/detail/json_parser_write.hpp')
-rw-r--r-- | boost/property_tree/detail/json_parser_write.hpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/boost/property_tree/detail/json_parser_write.hpp b/boost/property_tree/detail/json_parser_write.hpp index 7639887f65..b52c8eac6f 100644 --- a/boost/property_tree/detail/json_parser_write.hpp +++ b/boost/property_tree/detail/json_parser_write.hpp @@ -39,6 +39,7 @@ namespace boost { namespace property_tree { namespace json_parser else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f'); else if (*b == Ch('\n')) result += Ch('\\'), result += Ch('n'); else if (*b == Ch('\r')) result += Ch('\\'), result += Ch('r'); + else if (*b == Ch('\t')) result += Ch('\\'), result += Ch('t'); else if (*b == Ch('/')) result += Ch('\\'), result += Ch('/'); else if (*b == Ch('"')) result += Ch('\\'), result += Ch('"'); else if (*b == Ch('\\')) result += Ch('\\'), result += Ch('\\'); @@ -93,7 +94,8 @@ namespace boost { namespace property_tree { namespace json_parser stream << Ch(','); if (pretty) stream << Ch('\n'); } - stream << Str(4 * indent, Ch(' ')) << Ch(']'); + if (pretty) stream << Str(4 * indent, Ch(' ')); + stream << Ch(']'); } else @@ -106,12 +108,7 @@ namespace boost { namespace property_tree { namespace json_parser { if (pretty) stream << Str(4 * (indent + 1), Ch(' ')); stream << Ch('"') << create_escapes(it->first) << Ch('"') << Ch(':'); - if (pretty) { - if (it->second.empty()) - stream << Ch(' '); - else - stream << Ch('\n') << Str(4 * (indent + 1), Ch(' ')); - } + if (pretty) stream << Ch(' '); write_json_helper(stream, it->second, indent + 1, pretty); if (boost::next(it) != pt.end()) stream << Ch(','); |