All pages
Powered by GitBook
1 of 1

Loading...

ascent.decode

Decoding methods for data in Ascent

Ascent.decode - Data Decoding Methods

Apica.decode.base64

decodes a string in Base64 format.

Parameter
Type
Description

Examples

To base64-encode the username

Ascent.decode.gzip

Compress a string using Gzip. Output a base64 encode string

Parameter
Type
Description

Examples

To encode the username

Ascent.decode.uri

Encodes a string using URI encoding

Parameter
Type
Description

Examples

To decode the username

decodes a string in Hexadecimal format.

Parameter
Type
Description

Examples

To decode the username

Ascent.decode.unflatten

Transforms a flattened object into a nested JSON structure. Useful for reconstructing nested data models from flat key-value mappings.

Parameter
Type
Description

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): String
Event.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"
    }
  ]
}
*/