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    // create byte vector
10c5f01b2fSopenharmony_ci    std::vector<std::uint8_t> v = {0x7B, 0x69, 0x07, 0x63, 0x6F, 0x6D, 0x70, 0x61,
11c5f01b2fSopenharmony_ci                                   0x63, 0x74, 0x54, 0x69, 0x06, 0x73, 0x63, 0x68,
12c5f01b2fSopenharmony_ci                                   0x65, 0x6D, 0x61, 0x69, 0x00, 0x7D
13c5f01b2fSopenharmony_ci                                  };
14c5f01b2fSopenharmony_ci
15c5f01b2fSopenharmony_ci    // deserialize it with UBJSON
16c5f01b2fSopenharmony_ci    json j = json::from_ubjson(v);
17c5f01b2fSopenharmony_ci
18c5f01b2fSopenharmony_ci    // print the deserialized JSON value
19c5f01b2fSopenharmony_ci    std::cout << std::setw(2) << j << std::endl;
20c5f01b2fSopenharmony_ci}
21