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:
4:10a99cdf7846
Child:
7:a2fabe322eff
--- a/MbedJSONValue.h	Wed Aug 24 19:11:59 2016 +0000
+++ b/MbedJSONValue.h	Thu Nov 24 20:25:42 2016 +0000
@@ -35,8 +35,8 @@
 /*!< Number maximum of MbedJSONValue in an array or an object */
 
 #include <string>
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
 #include <string.h>
 
 /** MbedJSONValue class
@@ -525,9 +525,9 @@
     }
     char* endp;
     if (strchr(num_str.c_str(), '.') != NULL || strchr(num_str.c_str(), 'e') != NULL || strchr(num_str.c_str(), '+') != NULL)
-        out = MbedJSONValue(strtod(num_str.c_str(), &endp));
+        out = MbedJSONValue(std::strtod(num_str.c_str(), &endp));
     else
-        out = MbedJSONValue((int)strtod(num_str.c_str(), &endp));
+        out = MbedJSONValue((int)std::strtod(num_str.c_str(), &endp));
     return endp == num_str.c_str() + num_str.size();
 }
 
@@ -574,7 +574,7 @@
     input in = input(first, last);
     if (! _parse(out, in) && err != NULL) {
         char buf[64];
-        sprintf(buf, "syntax error at line %d near: ", in.line());
+        std::sprintf(buf, "syntax error at line %d near: ", in.line());
         *err = buf;
         while (1) {
             int ch = in.getc();