Opened 9 years ago

Closed 8 years ago

#9765 closed Bugs (duplicate)

write_json(.., /*pretty=*/false) still outputs unnecessary spaces

Reported by: j.lonnee@… Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

Using boost::property_tree::write_json(output, data, /*pretty=*/false); with an array in the data still outputs spaces before the ']'.

When you want to calculate HASH-es from JSON (and therefor do not want extra whitespaces in it) generated by different tools that is a problem.

Change History (2)

comment:1 by anonymous, 9 years ago

See http://www.boost.org/doc/libs/1_55_0/boost/property_tree/detail/json_parser_write.hpp :

In function 'write_json_helper' please replace the line:

stream << Str(4 * indent, Ch(' ')) << Ch(']');

With the 2 lines:

if (pretty) stream << Str(4 * indent, Ch(' '));
stream << Ch(']');

comment:2 by Sebastian Redl, 8 years ago

Resolution: duplicate
Status: newclosed

Dupe of #7180.

Note: See TracTickets for help on using tickets.