1 #include <iostream> 2 #include <nlohmann/json.hpp> 3 4 using json = nlohmann::json; 5 main()6int 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 } 17