Use this when using expressions in n8n nodes.
Expressions
n8n expressions are JavaScript snippets in {{ }} that read data from previous nodes, such as {{ $json.email }} or {{ $('HTTP Request').item.json.id }}, to build dynamic values.
1. Expressions access item data and context ({{ }} JavaScript-like).
2. Handle missing fields.
3. Keep complex logic in Code nodes.
4. Test with pinned data.
5. Avoid secrets in expressions.
item data → expression → value
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Expressions that break when a field is missing.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Expressions are JavaScript in {{ }}.
- Use $json and $('Node') to read data.
- Test them in the editor.
{{ $json.field }} / {{ $('Node').item.json.x }}— expression examples- Expression preview in editor — testing
- Null-safe access — robustness
ReferenceWhy it matters1 section · depth on demand
What it is
Expressions ({{ $json.field }}) read data from previous nodes and transform it inline.
ReferenceImportant terms & boundaries2 sections · depth on demand
How it works
n8n expressions run JavaScript inside {{ }} with helpers such as $json (current item), $('Node name') (another node's output), $now and $env. They are evaluated per item, so a workflow processing 100 items runs the expression 100 times.
Example
{{ $json.hostname.toLowerCase() }}
{{ $('HTTP Request').item.json.id }}
{{ $now.toISO() }}
Expressions are JavaScript; use ?. and defaults for optional fields.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in n8n > Expressions. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.n8n.io/ · confidence 94%