Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion include/boost/property_tree/json_parser/detail/write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ namespace boost { namespace property_tree { namespace json_parser
if (!verify_json(pt, 0))
BOOST_PROPERTY_TREE_THROW(json_parser_error("ptree contains data that cannot be represented in JSON format", filename, 0));
write_json_helper(stream, pt, 0, pretty);
stream << std::endl;

if (pretty) stream << std::endl;
else stream << std::flush;

if (!stream.good())
BOOST_PROPERTY_TREE_THROW(json_parser_error("write error", filename, 0));
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_json_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const char *bug_data_pr7180_1 =
" ]\n"
"}\n";
const char *bug_data_pr7180_2 =
"{\"a\":[\"1\",\"2\"]}\n";
"{\"a\":[\"1\",\"2\"]}";

struct ReadFunc
{
Expand Down