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-21 13:35:40 +03:00
|
|
|
|
|
|
|
|
using json = nlohmann::json;
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
// a JSON text given as std::vector
|
2021-12-29 15:41:01 +03:00
|
|
|
std::vector<std::uint8_t> text = {'[', '1', ',', '2', ',', '3', ']', '\0'};
|
2016-08-21 13:35:40 +03:00
|
|
|
|
|
|
|
|
// parse and serialize JSON
|
|
|
|
|
json j_complete = json::parse(text);
|
|
|
|
|
std::cout << std::setw(4) << j_complete << "\n\n";
|
|
|
|
|
}
|