C++ syntax sugar wrapper for cJSON.
cJSON is good, but using C++’s operation overloading makes it as easy as using Python with little added overhead. Best suited for microcontrollers. Other JSON libs are typically too big, memory intensive, or slow.
Using it is as you’d expect from a high-level json implementation. Other examples can be seen under the tests.
#include "json.hpp"
auto doc = json::obj("foo", json::obj("a", 1, "b", 2.2),
"bar", json::arr(1, 2, 3, 4));
doc["foo"]["c"] = "hello world";
doc["bar"][3] = json::arr("a", "b", "c");
auto doc2 = json::parse(doc.stringify());
std::cout << (doc == doc2) << std::endl;
// outputs: 1
std::cout << doc << std::endl;
// outputs: {"foo":{"a":1,"b":2.2,"c":"hello world"},"bar":[1,2,3,["a","b","c"]]}GPL3