Expressions: dynamic values
An expression fills a node parameter with a value computed from incoming data instead of a fixed one. The syntax is double curly braces: {{ ... }}, with a JavaScript expression inside.
The three references you use most:
{{ $json.field }}— the current item's data{{ $('Node name').item.json.field }}— the linked item from a previous node{{ $('Node name').first().json.field }}— the first item of a previous node
$json is in fact shorthand for $input.item.json. You usually do not type it: dragging a field from the INPUT panel into a parameter makes n8n write the expression for you.
| Expression | What it returns | Works in the Code node? |
|---|---|---|
| `$json` | The current item's JSON data | Yes — in "Run Once for Each Item" mode |
| `$input.item` / `$input.all()` | The current item / all incoming items | Yes |
| `$('Node').item` | That node's item linked to the current one | Yes (use `itemMatching()` to trace back) |
| `$('Node').first() / .last() / .all()` | That node's first / last / all items | Yes |
| `$binary` | The current item's binary data | No |
| `$now` / `$today` | The current moment / the start of today (Luxon objects) | Yes, though some n8n-specific methods differ |
| `$jmespath()`, `$if()` | Data transformation helpers | No — expression editor only |
The node name is part of the expression. Write $('HTTP Request') and then rename that node, and the expression breaks. So name nodes meaningfully and early — renaming later means fixing every reference by hand.
Date handling goes through the Luxon library. n8n passes dates between nodes as strings, so you parse before operating on them. $now and $today are ready-made Luxon objects.
The official recommendation is to use Luxon's DateTime rather than plain JavaScript Date() in n8n, because Date() does not work correctly with some n8n features such as the workflow-specific timezone setting.
Careful: not everything available in the expression editor exists in the Code node. The Code node runs plain Node.js, not n8n's expression engine. Helpers like $if() and $jmespath() are absent there, and some Luxon methods take different arguments.
📚 Sources and documentation
- Reference previous nodesofficialdocs.n8n.io
The official source of the table above, including which methods work in the Code node.
- Built-in methods and variablesofficialdocs.n8n.io
- Work with dates and timesofficialdocs.n8n.io
Luxon, `$now`, `$today` and timezone behaviour.