]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | #include <iostream> |
2 | #include <nlohmann/json.hpp> | |
3 | ||
4 | using json = nlohmann::json; | |
5 | ||
6 | int main() | |
7 | { | |
8 | // create an array by creating copies of a JSON value | |
9 | json value = "Hello"; | |
10 | json array_0 = json(0, value); | |
11 | json array_1 = json(1, value); | |
12 | json array_5 = json(5, value); | |
13 | ||
14 | // serialize the JSON arrays | |
15 | std::cout << array_0 << '\n'; | |
16 | std::cout << array_1 << '\n'; | |
17 | std::cout << array_5 << '\n'; | |
18 | } |