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