This is a simple JSON parser. When I first read about JSON I liked how simple and straightforward its formatting was. So I decided to write a little parser for it because it would be so easy to do.
The main work is done using the ParseJSON() function defined in value.h. It returns a Value object containing all the data that was parsed out. Example:
Value *v=ParseJSON("{ \"myint\" : 5 , \"myarray\" : [ 2, 4, 6 ] }"); Value &a=(*v)["myarray"]; // get the array member Value &n=a[1]; // get one of the numbers printf("%i\n",n.AsInt()); // should print "4" // or a more compact way: printf("%i\n",(*v)["myarray"][2].AsInt()); // should print "6" delete v;
1.5.2