#include#include "JsonValue.h" int main() { JsonValue value = JsonValue::fromString("{\"name\": \"John\", \"age\": 30}"); std::cout << "Name: " << value["name"].asString() << std::endl; std::cout << "Age: " << value["age"].asInt() << std::endl; return 0; }
#includeThis example shows how to create a JSON array using the `array` method and access its values using the `JsonValue` class. The `size` method returns the number of elements in the JSON array, which can then be iterated over using a `for` loop. The package library for Cpp JsonValue is likely a custom library developed specifically for this project.#include "JsonValue.h" int main() { JsonValue value = JsonValue::array({1, 2, 3, 4, 5}); std::cout << "Size: " << value.size() << std::endl; for (int i = 0; i < value.size(); i++) { std::cout << value[i].asInt() << ", "; } std::cout << std::endl; return 0; }