n8n Expressions Cheatsheet (Copy-Pasteable)
Every n8n expression you actually need — $json, $node, dates, strings, arrays, and conditionals. Pin this tab.
Key takeaways
- {{ $json.field }} — current node's incoming field.
- {{ $('Node Name').item.json.field }} — pull from any upstream node.
- DateTime functions use Luxon, not Moment.
- $jmespath() is unreasonably useful for nested JSON.
Expressions are how you reference data between nodes without dropping into the Code node. The official docs are exhaustive; this cheatsheet is what you actually use 95% of the time.
Data access
$json — current item's JSON. $binary — current item's binary. $input.all() — all items. $('Webhook').item.json — first item from named node. $('Loop').all() — all items from named node.
Dates
{{ $now.toISO() }} — current ISO. {{ $now.plus({days: 7}).toFormat('yyyy-MM-dd') }} — add a week. {{ DateTime.fromISO($json.created).diffNow('days').days }} — age in days.
Strings
{{ $json.email.toLowerCase().trim() }}. {{ $json.name.split(' ')[0] }}. {{ $json.text.slice(0, 280) }}.
Arrays
{{ $json.items.map(i => i.id) }}. {{ $json.items.filter(i => i.active).length }}. {{ $json.items.reduce((a,b) => a + b.amount, 0) }}.
Conditionals
{{ $json.score > 50 ? 'hot' : 'cold' }}. {{ $json.email || $json.alt_email || 'unknown' }}.
Frequently asked questions
- How do I reference a node with spaces in the name?
- $('Node Name with spaces').item.json — quotes around the name.
- Why is my expression returning [object Object]?
- You're stringifying an object. Use JSON.stringify($json) or pick a specific field.