#include#include "json/json.h" int main() { Json::Value obj; obj["name"] = "John"; obj["age"] = 25; std::cout << obj.toStyledString(); return 0; }
#includeThis example creates a JSON array with three string values, and then we print the array in a human-readable format using the `toStyledString()` method. The package library used in these examples is the cpp json library.#include "json/json.h" int main() { Json::Value array; array.append("apple"); array.append("banana"); array.append("orange"); std::cout << array.toStyledString(); return 0; }