#include#include "json/json.h" using namespace std; int main() { Json::Value jsonValue; jsonValue = 123; unsigned int value = jsonValue.asUInt(); cout << "Value: " << value << endl; return 0; }
#includeIn this example, a `Json::Value` object is assigned a value of `true`. `asUInt()` is then called on this object, which will give an output of 1 since true is represented as 1 in a boolean context. The cpp json library can be downloaded from https://github.com/open-source-parsers/jsoncpp.#include "json/json.h" using namespace std; int main() { Json::Value jsonValue; jsonValue = true; unsigned int value = jsonValue.asUInt(); cout << "Value: " << value << endl; return 0; }