Reference for n8n expression syntax, built-in variables, and data access patterns.
n8n uses double curly braces {{ }} to embed expressions in node parameters. Anything inside the braces is evaluated as JavaScript at runtime and replaced with the result.
{{ $json.firstName + ' ' + $json.lastName }}
Toggle a parameter field to Expression mode (the = icon) before entering an expression.
| Variable | Description |
|---|---|
$json |
The json property of the current item from the immediately preceding node |
$binary |
The binary property of the current item (file data) |
$input.item.json |
Same as $json (explicit form) |
{{ $json.email }}
{{ $json.address.city }}
{{ $json.tags[0] }}
Reference a node by name to access its output:
{{ $('Customer Lookup').item.json.name }}
{{ $('HTTP Request').first().json.id }}
{{ $('HTTP Request').all() }}
| Method | Returns |
|---|---|
$input.all() |
Array of all items from the immediate parent |
$input.first() |
The first item from the immediate parent |
$('Node Name').all() |
All items from a named node |
| Variable | Description |
|---|---|
$now |
Current date/time as a Luxon DateTime object |
$today |
Current date at midnight as a Luxon DateTime |
$workflow.id |
ID of the current workflow |
$workflow.name |
Name of the current workflow |
$workflow.active |
Whether the workflow is active (true/false) |
$execution.id |
ID of the current execution |
$execution.mode |
manual or production |
$execution.resumeUrl |
URL to resume a waiting execution |
$runIndex |
How many times the current node has run in this execution (useful in loops) |
$itemIndex |
Index of the current item in the input array |
$position |
Same as $itemIndex |
Full JavaScript is available inside {{ }}. Common patterns:
{{ $json.price * 1.1 }}
{{ $json.status === 'active' ? 'Yes' : 'No' }}
{{ $json.tags.join(', ') }}
{{ new Date($json.timestamp).toISOString() }}
{{ $now.minus({ days: 7 }).toISO() }}
Warning
Expressions must be single-line evaluations that return a value. For multi-line logic, use the Code node instead.
Default value when field is missing:
{{ $json.nickname ?? $json.firstName ?? 'Unknown' }}
Format a date:
{{ $now.toFormat('yyyy-MM-dd') }}
Build a dynamic URL:
{{ 'https://api.example.com/users/' + $json.userId }}
Tip
Use the Expression Editor (click the field, then the expression tab) to get autocomplete suggestions and preview results against real execution data.
Related tips: Data Transformation, Code Node Mastery
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.