#includeint main() { Json::Value root; root["name"] = "John"; std::string name = root["name"].asString(); // name is now "John" return 0; }
#includeIn this example, a nested `JsonObject` is created and assigned a key-value pair where the key is "age" and the value is an integer 30. The nested `JsonObject` can be accessed by chaining the keys (using `["person"]["age"]`). Finally, the integer value is retrieved using `asInt()` method.int main() { Json::Value root; root["person"]["age"] = 30; int age = root["person"]["age"].asInt(); // age is now 30 return 0; }