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 as string that is not null-terminated
10c5f01b2fSopenharmony_ci    const char* ptr = "[1,2,3]another value";
11c5f01b2fSopenharmony_ci
12c5f01b2fSopenharmony_ci    // parse and serialize JSON
13c5f01b2fSopenharmony_ci    json j_complete = json::parse(ptr, ptr + 7);
14c5f01b2fSopenharmony_ci    std::cout << std::setw(4) << j_complete << "\n\n";
15c5f01b2fSopenharmony_ci}
16