Minimalist JSON parser and serializer (inspired by picojson). Used by MbedJSONRpc. (Original by Samuel Mokrani)

Dependents:   City_Game_JSON City_Game_JSON

Fork of MbedJSONValue by Samuel Mokrani

Revision:
6:c21b9ffd9628
Parent:
5:ba03a74f9119
Child:
7:a2fabe322eff
--- a/MbedJSONValue.cpp	Wed Aug 24 19:11:59 2016 +0000
+++ b/MbedJSONValue.cpp	Thu Nov 24 20:25:42 2016 +0000
@@ -1,7 +1,7 @@
 #include "MbedJSONValue.h"
 
-# include <stdlib.h>
-# include <stdio.h>
+#include <cstdio>
+#include <cstdlib>
 
 // Clean up
 void MbedJSONValue::clean() {
@@ -58,7 +58,7 @@
             default:
                 if ((unsigned char)*i < 0x20 || *i == 0x7f) {
                     char buf[7];
-                    sprintf(buf, "\\u%04x", *i & 0xff);
+                    std::sprintf(buf, "\\u%04x", *i & 0xff);
                     copy(buf, buf + 6, oi);
                 } else {
                     *oi++ = *i;
@@ -83,12 +83,12 @@
             return _value.asBool ? "true" : "false";
         case TypeInt:    {
             char buf[10];
-            sprintf(buf, "%d", _value.asInt);
+            std::sprintf(buf, "%d", _value.asInt);
             return buf;
         }
         case TypeDouble:    {
             char buf[10];
-            sprintf(buf, "%f", _value.asDouble);
+            std::sprintf(buf, "%f", _value.asDouble);
             return buf;
         }
         default: