blazor_convert_to_formatted
Decodes a raw MessagePack buffer into human-readable JSON.
C Language
int blazor_convert_to_formatted("<messagepack_buffer>", "TargetParam=<parameter_name>" );
| Blazor - Web Functions |
| Argument | Description |
|---|---|
| messagepack_buffer | The MessagePack buffer to decode. The input can be a hex-escaped byte string such as \x91\xA9... (preferred option,) or a literal string input. |
| TargetParam | The name of the parameter that stores the decoded JSON output. |
Return Values
This function stores the decoded JSON in the target parameter.
Parameterization
You cannot use standard parameterization for this function.
General Information
The blazor_convert_to_formatted function is a helper function and is never auto-generated during recording.
The input must contain a MessagePack buffer, with or without a byte-size prefix. However, when multiple encoded buffers are concatenated, each buffer must include a byte-size prefix, so that the decoder can separate the messages.
Examples
The following example decodes a simple MessagePack buffer.
blazor_convert_to_formatted(
"\\x91\\xA9\\x42\\x6C\\x61\\x7A\\x6F\\x72\\x57\\x65\\x62",
"TargetParam=FormattedValue");
/* FormattedValue = ["BlazorWeb"] */The following example decodes a MessagePack buffer that includes a byte-size prefix.
blazor_convert_to_formatted(
"\\x0B\\x91\\xA9\\x42\\x6C\\x61\\x7A\\x6F\\x72\\x57\\x65\\x62",
"TargetParam=FormattedValue");
/* FormattedValue = ["BlazorWeb"] */The following example decodes two concatenated messages.
blazor_convert_to_formatted(
"\\x0B\\x91\\xA9\\x42\\x6C\\x61\\x7A\\x6F\\x72\\x57\\x65\\x62\\x19\\x91\\xB7\\x42\\x6C\\x61\\x7A\\x6F\\x72\\x57\\x65\\x62\\x41\\x6E\\x6F\\x74\\x68\\x65\\x72\\x4D\\x65\\x73\\x73\\x61\\x67\\x65",
"TargetParam=FormattedValue");
/* FormattedValue = ["BlazorWeb"]["BlazorWebAnotherMessage"] */

