Helpers
Defaults for empty values, slugs, JMESPath queries and lodash.
Each example was run against the deployed expression engine over the example context at the end of the page.
$ifEmpty
Returns fallback when value is undefined, null, an empty string '', an empty list or an object without keys. Any other value is returned as it is: 0, false and a string of spaces are kept.
Parameters
-
valueany required - The value to check, usually a read that may be missing.
-
fallbackany required - What to return when
valueis empty. Any type.
Returns
any value or fallback, with its own type.
Examples
An empty string takes the fallback.
A node that did not run.
0 is not empty.
Notes
- To also replace
0orfalse, use||:{{ $json.body.retries || 3 }}. To replace onlynullandundefined, use??.
In JSONata $$ifEmpty(body.priority, "normal")
$slugify
Turns any text into kebab case (lodash kebabCase): lowercase words joined by hyphens, accents removed, punctuation dropped. Words are also split where the case changes and between letters and digits, so helloWorld ABC123 becomes hello-world-abc-123.
Parameters
-
textany required - Converted to text first:
nullbecomes'null'.
Returns
string The slug; an empty string for empty text.
Examples
Notes
- Guard missing values first:
$slugify($ifEmpty($json.title, 'untitled')).
In JSONata $$slugify(body.customer.name)
$jmespath
Runs a JMESPath query over data and returns what it selects: a value, a list or an object. A query is often shorter than the JavaScript for deep responses: filters ([?qty > \0`]), projections ([*].sku) and functions (length, sort_by, max_by`). Literals go between backticks inside the query.
Parameters
-
dataany required - The value to query, usually
$jsonor a node's output. -
querystring required - A JMESPath expression. Write it between single quotes so the backticks and double quotes inside it need no escaping.
Returns
any What the query selects; null when nothing matches.
Examples
A path that does not exist gives null, not an error.
A literal without backticks is a syntax error.
Errors
| Message | Cause and fix |
|---|---|
Invalid token (<type>): "<value>" | The query is not valid JMESPath, often a number or a string literal without backticks. |
In JSONata $$jmespath($$json, "body.items[0].sku")
_
The full lodash library. It is the shortest way to group, sum, pick, deduplicate and read deep paths with a default.
Examples
Notes
- Every function with its parameters, return value and examples is in the lodash reference.
In JSONata Not available in JSONata, which has its own function library.
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