2017-07-09 12:51:38 +03:00
|
|
|
#include <iostream>
|
2018-08-16 22:53:47 +03:00
|
|
|
#include <iomanip>
|
2018-02-02 00:20:26 +03:00
|
|
|
#include <nlohmann/json.hpp>
|
2016-08-24 22:02:33 +03:00
|
|
|
|
|
|
|
using json = nlohmann::json;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// a JSON text
|
|
|
|
char text[] = R"(
|
|
|
|
{
|
|
|
|
"Image": {
|
|
|
|
"Width": 800,
|
|
|
|
"Height": 600,
|
|
|
|
"Title": "View from 15th Floor",
|
|
|
|
"Thumbnail": {
|
|
|
|
"Url": "http://www.example.com/image/481989943",
|
|
|
|
"Height": 125,
|
|
|
|
"Width": 100
|
|
|
|
},
|
|
|
|
"Animated" : false,
|
|
|
|
"IDs": [116, 943, 234, 38793]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)";
|
|
|
|
|
|
|
|
// parse and serialize JSON
|
|
|
|
json j_complete = json::parse(text);
|
|
|
|
std::cout << std::setw(4) << j_complete << "\n\n";
|
|
|
|
}
|