Skip to content

decodeBase64 - Decode a base64 string

decodeBase64 will transform a Base64 encoded string back into its original value.

Syntax

Like many functions in DataPrime, decodeBase64 supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

decodeBase64(value: string): string
value: string.decodeBase64(): string

Arguments

NameTypeRequiredDescription
valuestringtrueThe base64 encoded string to be decoded

Example - Decoding base64 encoded URLs

It's common to send data that contains special or reserved characters, like URLs, in Base64 encoded format, to ensure there are no parsing issues.

{
    "path": "/home",
    "domain": "coralogix.com",
    "full_url_encoded": "aHR0cHM6Ly9jb3JhbG9naXguY29tL2hvbWU=" 
}

If we want to view the original full_url value, we can use decodeBase64:

create full_url from decodeBase64(full_url_encoded)
create full_url from full_url_encoded.decodeBase64()

The resulting document will look like this:

{
    "path": "/home",
    "domain": "coralogix.com",
    "full_url_encoded": "aHR0cHM6Ly9jb3JhbG9naXguY29tL2hvbWU=",
    "full_url": "https://coralogix.com/home"
}