1c5f01b2fSopenharmony_ci#include <iostream>
2c5f01b2fSopenharmony_ci#include <iomanip>
3c5f01b2fSopenharmony_ci#include <nlohmann/json.hpp>
4c5f01b2fSopenharmony_ci
5c5f01b2fSopenharmony_ciusing json = nlohmann::json;
6c5f01b2fSopenharmony_ci
7c5f01b2fSopenharmony_ciint main()
8c5f01b2fSopenharmony_ci{
9c5f01b2fSopenharmony_ci    // a JSON text given an input with other values
10c5f01b2fSopenharmony_ci    std::vector<std::uint8_t> input = {'[', '1', ',', '2', ',', '3', ']', 'o', 't', 'h', 'e', 'r'};
11c5f01b2fSopenharmony_ci
12c5f01b2fSopenharmony_ci    // parse and serialize JSON
13c5f01b2fSopenharmony_ci    json j_complete = json::parse(input.begin(), input.begin() + 7);
14c5f01b2fSopenharmony_ci    std::cout << std::setw(4) << j_complete << "\n\n";
15c5f01b2fSopenharmony_ci}
16