$base64encode
$base64encode(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
Encodes a string as base64 text.
If the input is undefined, the function returns undefined. Use this helper when you need a transport-safe string representation and $base64decode() to recover the original UTF-8 text later in the mapping.
Examples
Encode a patient display name
Input
This example uses the patient-summary example input. The expression encodes the display name so it can be carried as text without spaces or punctuation issues.
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
$base64encode(name.display)
Result
"QXZlcnkgUmVlZA=="