Decoding methods for data in Ascent
decodes a string in Base64 format.
Examples
To base64-encode the username
Compress a string using Gzip. Output a base64 encode string
Examples
To encode the username
Encodes a string using URI encoding
Examples
To decode the username
decodes a string in Hexadecimal format.
Examples
To decode the username
Transforms a flattened object into a nested JSON structure. Useful for reconstructing nested data models from flat key-value mappings.
Examples Unflatten a flattened object:
ascent.decode.b64(input:string):string;string
string
Value to decode
string
string
Value to encode
string
string
Value to encode
string
string
Value to encode
input
{}<string, any>
Flattened key-value object
Event.decode = Ascent.decode.b64("Username")ascent.decode.gzip(input: string): string;Event.decode = Ascent.decode.b64("Username");Ascent.decode.uri(input: string): string;Event.decode = Ascent.decode.uri("Username");Ascent.decode.hex(input: String): StringEvent.decode = Ascent.decode.hex("Username");ascent.decode.unflatten(input: Record<string, any>): object;let flattened = {
"resource[0].name": "Kevin",
"resource[0].value": "Test"
};
let unflattened = ascent.decode.unflatten(flattened);
/*
Result:
{
"resource": [
{
"name": "Kevin",
"value": "Test"
}
]
}
*/