Basic Implementation of JSON. Capable of create a JSON string and parse a JSON string. Uses the "lazy" JSON implementation. Incapable of modify and delete variables from the objects. Contains 2 objects: JSONArray and JSONObject. Inspired in Java-Android implementation of JSON. Version 0.5.

Dependents:   mbed_networking

Revision:
0:7aaa16136d09
Child:
1:ac1512fd0d1e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oJSON.h	Sat Nov 24 17:02:34 2012 +0000
@@ -0,0 +1,85 @@
+#include "mbed.h"
+#include <string>
+#include <sstream>
+
+//CLASSES
+
+class JSONArray;
+
+class JSONObject{
+
+    int nValues;
+    string* labels;
+    string* values;
+
+    public:
+
+        JSONObject ();
+        JSONObject (string);
+        JSONObject (char*);
+
+        int getInt (string);
+        int getInt (char*);
+        float getFloat (string);
+        float getFloat (char*);
+        string getString (string);
+        string getString (char*);
+        JSONArray getArray (string);
+        JSONArray getArray (char*);
+        JSONObject getObject (string);
+        JSONObject getObject (char*);
+        bool getBoolean(char*);
+        bool getBoolean(string);
+        bool isNull(char*);
+        bool isNull(string);
+
+        string toString();
+
+        void add(string, string);
+        void add(string, int);
+        void add(string, float);
+        void add(string, bool);
+        void add(string, JSONObject);
+        void add(string, JSONArray);
+
+    private:
+            void criar(string);
+
+};
+
+class JSONArray{
+
+    int nValues;
+    string *values;
+
+
+    public:
+        JSONArray ();
+        JSONArray (string);
+        JSONArray (char*);
+
+        int getInt(int);
+        float getFloat (int);
+        string getString (int);
+        JSONObject getObject (int);
+        JSONArray getArray (int);
+        bool getBoolean(int);
+        bool isNull(int);
+
+        string toString();
+
+        void add(string);
+        void add(int);
+        void add(float);
+        void add(bool);
+        void add(JSONObject);
+        void add(JSONArray);
+
+    private:
+        void criar(string);
+
+};
+
+int numberOfChars(char, string);
+string clear(string);
+string *explode(char, string);
\ No newline at end of file