Skip to content

Latest commit

 

History

History
71 lines (44 loc) · 1.05 KB

README.md

File metadata and controls

71 lines (44 loc) · 1.05 KB

rabbit Build Status

rabbit is a very handy rapidjson wrapper library.

dependencies

how to use

load

std::string json = "{\"value\": 123}";

rabbit::document doc;
doc.parse(json);

int value = doc["value"].as_int();
std::cout << value << std::endl; // 123

dump

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}}

test

  • require : boost.test
mkdir build
cd build
cmake ..
make
make test

benchmark

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

score

rapidjson time: 834330
rabbit    time: 837909
picojson  time: 3418777