MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / decode_cbor_byte_string

Function decode_cbor_byte_string

examples/src/cbor_examples.cpp:130–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void decode_cbor_byte_string()
131{
132 // byte string of length 5
133 std::vector<uint8_t> buf = {0x45,'H','e','l','l','o'};
134 json j = cbor::decode_cbor<json>(buf);
135
136 auto bytes = j.as<byte_string>();
137
138 // byte_string to ostream displays as hex
139 std::cout << "(1) "<< bytes << "\n\n";
140
141 // byte string value to JSON text becomes base64url
142 std::cout << "(2) " << j << '\n';
143}
144
145void decode_byte_string_with_encoding_hint()
146{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected