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 = {0xa2, 0x67, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63,
11c5f01b2fSopenharmony_ci                                   0x74, 0xf5, 0x66, 0x73, 0x63, 0x68, 0x65, 0x6d,
12c5f01b2fSopenharmony_ci                                   0x61, 0x00
13c5f01b2fSopenharmony_ci                                  };
14c5f01b2fSopenharmony_ci
15c5f01b2fSopenharmony_ci    // deserialize it with CBOR
16c5f01b2fSopenharmony_ci    json j = json::from_cbor(v);
17c5f01b2fSopenharmony_ci
18c5f01b2fSopenharmony_ci    // print the deserialized JSON value
19c5f01b2fSopenharmony_ci    std::cout << std::setw(2) << j << std::endl;
20c5f01b2fSopenharmony_ci}
21