Class implements serialization and deserialization of JSON-formatted text.
JsonObject jsonObject;
jsonObject.setValue("bool", true);
jsonObject.setValue("number", 123.4567);
jsonObject.setValue("text", "Hello world!");
cout << jsonObject.stringify(JsonObject::MODE_COMPACT) << endl;
// {"bool":true,"number":123.4567000000,"text":"Hello world!"}
string data = "{\"bool\": false, \"num\":123.457, \"name\":\"Jane\"}";
JsonObject jsonObject;
jsonObject.parse(data);
string name = jsonObject.value("name").toString();
double num = jsonObject.value("num").toNumber();
cout << "name: " << name << ", num: " << num << endl;
// name: Jane, num: 123.457