Skip to content

Create a basic json


Example on how to create a basic json like this:

Will create json:
{
    "name": "Peter Griffin",
    "age": 58,
    "shape": "obese",
}
Procedural (C++):
Json json = JsonBlock(); // Create empty JsonData of type JSON

json["name"]  = "Peter Griffin";
json["age"]   = 58;
json["shape"] = "obese";

std::cout << json << std::endl;
Inline (C++):
Json json = JsonBlock({
    Ele("name", "Peter Griffin"),
    Ele("age", 58),
    Ele("shape", "obese")
});

std::cout << json << std::endl;