$base64decode
$base64decode(string?) -> stringCompact type signature
<s-:s>If string is omitted, the current context value is used.
Source: FUME*
* FUME replaces the original JSONata base64 helpers with UTF-8-aware implementations.
Documentation
Decodes a base64 string into UTF-8 text.
If the input is undefined, the function returns undefined. This helper is useful when a mapping receives encoded text and needs to recover the original string before further parsing or matching.
Examples
Decode a previously encoded display name
Input
This example uses the patient-summary example input. The expression base64-encodes the patient display name and immediately decodes it again to show the return shape.
Example input
JSON
{
"patientId": "pat-0001",
"name": {
"given": "Avery",
"family": "Reed",
"display": "Avery Reed"
},
"birthDate": "1990-06-12",
"sex": "female",
"primaryCareTeam": {
"organization": "ExampleCare",
"facility": "ExampleCare Clinic",
"practitioner": {
"practitionerId": "prac-4001",
"display": "Jordan Kim"
}
},
"identifiers": {
"memberId": "mbr-3001",
"recordNumber": "rec-5001"
},
"tags": [
"demo",
"fictional"
],
"_xmlTagName": "patientSummary"
}
Expression
$base64decode($base64encode(name.display))
Result
"Avery Reed"