1 #include <iostream>
2 #include <iomanip>
3 #include <nlohmann/json.hpp>
4
5 using json = nlohmann::json;
6
main()7 int main()
8 {
9 // a JSON text
10 char text[] = R"(
11 {
12 "Image": {
13 "Width": 800,
14 "Height": 600,
15 "Title": "View from 15th Floor",
16 "Thumbnail": {
17 "Url": "http://www.example.com/image/481989943",
18 "Height": 125,
19 "Width": 100
20 },
21 "Animated" : false,
22 "IDs": [116, 943, 234, 38793]
23 }
24 }
25 )";
26
27 // parse and serialize JSON
28 json j_complete = json::parse(text);
29 std::cout << std::setw(4) << j_complete << "\n\n";
30 }
31