Skip to content

decodeBase64

Description

Decodes a Base64-encoded string 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 decode

Example

Decode a Base64-encoded URL

Consider the following document:

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

Use decodeBase64 to recover the original URL:

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

Output

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