May 23, 2011

DOM wrapper for lighting fast JSON parser

vjson-wrapper/
Sample use:
#include "json.h"

int main()
{

 json::document doc;
 const char* filename = "./test/pass1.json";

 bool res = doc.load(filename);

 json_type type = doc.type(); //JSON_ARRAY

 bool value0 = doc[5].as_bool(); //true
 const char* value1 = doc.array_first().str(); //"JSON Test Pattern pass1"

 const char* name1 = doc[1].child().name(); //"object with 1 member"

 int value3 = doc[8]("integer").as_int(); //1234567890


 for (json::value v = doc.child(); v; v = v.sibling())
 {

  switch(v.type())
  {
   //...
  }
 }
 return 0;
}