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

Function serialize_json_byte_string

examples/src/byte_string_examples.cpp:58–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void serialize_json_byte_string()
59{
60 std::vector<uint8_t> bytes = {'H','e','l','l','o'};
61
62 json j(byte_string_arg, bytes);
63
64 // default
65 std::cout << "(1) "<< j << "\n\n";
66
67 // base16
68 auto options2 = json_options{}
69 .byte_string_format(byte_string_chars_format::base16);
70 std::cout << "(2) "<< print(j, options2) << "\n\n";
71
72 // base64
73 auto options3 = json_options{}
74 .byte_string_format(byte_string_chars_format::base64);
75 std::cout << "(3) "<< print(j, options3) << "\n\n";
76
77 // base64url
78 auto options4 = json_options{}
79 .byte_string_format(byte_string_chars_format::base64url);
80 std::cout << "(4) "<< print(j, options4) << "\n\n";
81}
82
83int main()
84{

Callers 1

mainFunction · 0.85

Calls 2

printFunction · 0.85
byte_string_formatMethod · 0.80

Tested by

no test coverage detected