Skip to content

mashiro/rabbit

Folders and files

NameName
Last commit message
Last commit date
Dec 2, 2022
Apr 4, 2019
Apr 4, 2019
Jul 20, 2014
Apr 4, 2019
Apr 30, 2014
Apr 30, 2014
Apr 4, 2019
Apr 4, 2019
Dec 2, 2022

Repository files navigation

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