summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-12-14 19:45:13 +0000
committerrandomdan <randomdan@localhost>2011-12-14 19:45:13 +0000
commit7970b3b16332266586fe3bc32b76aa0cc466c2b8 (patch)
tree6d8aed8398435163245a63053ea80500a150b9e8
parentDrop Boost::program_options in favour of our own, pluggable system which inte... (diff)
downloadproject2-7970b3b16332266586fe3bc32b76aa0cc466c2b8.tar.bz2
project2-7970b3b16332266586fe3bc32b76aa0cc466c2b8.tar.xz
project2-7970b3b16332266586fe3bc32b76aa0cc466c2b8.zip
Don't write JSON numbers in scientific notation, use native C++ boolalpha for booleans
-rw-r--r--project2/json/serialize.cpp9
1 files 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) {