xxxxプログラマのメモ

先人に感謝と敬意

C++ JSON

mattn.kaoriya.net

stackoverflow.com

github.com

qiita.com

JSON for Modern C++ をこんな感じで使えば概ね期待通りでした。

// special iterator member functions for objects
for (json::iterator it = o.begin(); it != o.end(); ++it) {
std::cout << it.key() << " : " << it.value() << "\n";
}

// find an entry
if (o.find("foo") != o.end()) {
// there is an entry with key "foo"
}

// or simpler using count()
int foo_present = o.count("foo"); // 1
int fob_present = o.count("fob"); // 0

// delete an entry
o.erase("foo");


Thansk!