Imported Upstream version 1.2.4
[platform/upstream/json-glib.git] / json-glib / json-generator.c
index c47e7fe..879f3be 100644 (file)
@@ -1,5 +1,5 @@
 /* json-generator.c - JSON streams generator
- * 
+ *
  * This file is part of JSON-GLib
  * Copyright (C) 2007  OpenedHand Ltd.
  * Copyright (C) 2009  Intel Corp.
@@ -36,7 +36,6 @@
 
 #include "json-types-private.h"
 
-#include "json-marshal.h"
 #include "json-generator.h"
 
 struct _JsonGeneratorPrivate
@@ -343,6 +342,11 @@ dump_value (JsonGenerator *generator,
         g_string_append (buffer,
                          g_ascii_dtostr (buf, sizeof (buf),
                                          json_value_get_double (value)));
+       /* ensure doubles don't become ints */
+       if (g_strstr_len (buf, G_ASCII_DTOSTR_BUF_SIZE, ".") == NULL)
+         {
+           g_string_append (buffer, ".0");
+          }
       }
       break;