]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/examples/binary.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / examples / binary.cpp
1 #include <iostream>
2 #include <nlohmann/json.hpp>
3
4 using json = nlohmann::json;
5
6 int main()
7 {
8 // create a binary vector
9 std::vector<std::uint8_t> vec = {0xCA, 0xFE, 0xBA, 0xBE};
10
11 // create a binary JSON value with subtype 42
12 json j = json::binary(vec, 42);
13
14 // output type and subtype
15 std::cout << "type: " << j.type_name() << ", subtype: " << j.get_binary().subtype() << std::endl;
16 }