rabbit is a very handy rapidjson wrapper library.
std::string json = "{\"value\": 123}";
rabbit::document doc;
doc.parse(json);
int value = doc["value"].as_int();
std::cout << value << std::endl; // 123
rabbit::object root;
rabbit::object user = root["user"];
user["name"] = "yui";
user["age"] = 18;
std::cout << root.str() << std::endl; // {"user":{"name":"yui","age":18}}
- require : boost.test
mkdir build
cd build
cmake ..
make
make test
- require: picojson
wget "http://api.reddit.com/hot" -O hot.json
g++ -I. -I./thirdparty/picojson/ -I./thirdparty/rapidjson/include/ -O2 -o bench bench.cpp
./bench 1000 2> /dev/null
rapidjson time: 834330
rabbit time: 837909
picojson time: 3418777