From 7970b3b16332266586fe3bc32b76aa0cc466c2b8 Mon Sep 17 00:00:00 2001 From: randomdan Date: Wed, 14 Dec 2011 19:45:13 +0000 Subject: Don't write JSON numbers in scientific notation, use native C++ boolalpha for booleans --- project2/json/serialize.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/project2/json/serialize.cpp b/project2/json/serialize.cpp index 600d93d..ff2d778 100644 --- a/project2/json/serialize.cpp +++ b/project2/json/serialize.cpp @@ -31,6 +31,8 @@ namespace json { }; void serializeObject(const Object & o, std::ostream & s) { + s << std::boolalpha; + s << std::fixed; s << '{'; BOOST_FOREACH(const Object::value_type & v, o) { if (&v != &*o.begin()) { @@ -110,12 +112,7 @@ namespace json { } void serializeBoolean(const Boolean & b, std::ostream & s) { - if (b) { - s << "true"; - } - else { - s << "false"; - } + s << b; } void serializeNull(const Null &, std::ostream & s) { -- cgit v1.2.3