Encoders
Base64 and URL query strings.
Each example was run against the deployed expression engine over the example context at the end of the page.
$base64Encode
Encodes value with the URL-safe Base64 alphabet (- and _ instead of + and /) and without = padding. A string is encoded as UTF-8; any other value is serialized as JSON first. Empty values ('', null, undefined, 0, false) give an empty string.
Parameters
-
valuestring | object required - The text or value to encode.
Returns
string URL-safe Base64 text without padding.
Examples
Notes
- Some services require standard Base64 with padding (for example a
Basicauthorization header). Convert the result:{{ (function(){ var b = $base64Encode(text).replace(/-/g, '+').replace(/_/g, '/'); return b + '==='.slice((b.length + 3) % 4); })() }}, or bind a credential to the node instead of building the header.
In JSONata $$base64Encode(body.order_id)
$base64Decode
Decodes standard or URL-safe Base64, with or without padding, and returns the result as UTF-8 text. It never fails: characters outside the alphabet are skipped. To get an object back from encoded JSON, parse the text with JSON.parse.
Parameters
-
textstring required - Base64 text.
Returns
string The decoded text; an empty string for an empty value.
Examples
Back to an object.
Notes
- Binary content (a PDF, an image) does not survive the conversion to text: decode it in a code node or let the node that handles the file do it.
In JSONata $$base64Decode(body.state)
$toQueryString
Builds a query string from an object, percent-encoding keys and values. Nested objects and lists use brackets (filter[status], ids[0]), also encoded. The result starts with ?, ready to append to a URL; anything that is not an object gives an empty string.
Parameters
-
objectobject required - The parameters, one key per parameter.
Returns
string ?key=value&…, or '' when the argument is not an object.
Examples
false, 0 and empty strings are sent as null.
Notes
false,0and''become the textnull. Send them as strings ('false','0') or write that part of the URL yourself.
In JSONata $$toQueryString({ "status": "open" })
Example context
The examples run over this data: the input of the current node ($json), the nodes that already ran ($(…)), the ids of the run and the current node. The clock is fixed at 2026-11-26T14:30:00.000Z and the server zone is UTC, so $now and $today give the same values on every page.
{
"$json": {
"body": {
"order_id": "ord_1042",
"email": "[email protected]",
"customer": {
"name": "Ana Pérez",
"segment": "gold"
},
"priority": "",
"items": [
{
"sku": "A-100",
"qty": 2,
"price": 10.5
},
{
"sku": "B-200",
"qty": 0,
"price": 4
},
{
"sku": "C-300",
"qty": 1,
"price": 25
}
],
"tags": [
"new",
"web",
"new"
],
"created_at": "2026-11-25T09:15:00Z"
},
"headers": {
"content-type": "application/json"
},
"query": {},
"method": "POST"
}
}{
"Webhook Receiver": "= $json",
"Normalize input": {
"correlation_id": "c-7f3a",
"channel": "web"
},
"Classify": {
"label": "billing",
"confidence": 0.92
}
}{
"$execution": {
"id": "fir-xxxx",
"flow_instance_id": "fi-xxxx",
"flow_definition_id": "fd-xxxx",
"flow_version_id": "fv-xxxx",
"flow_slug": "order-intake"
},
"$node": {
"id": "node-notify",
"label": "Notify customer"
}
} Examples run against the orchestrator at commit 31e874b