n8n Expression Syntax
All dynamic content in n8n uses double curly braces:Core Variables
$json — Current Node Output
Access data from the current node in the workflow:
$node — Reference Other Nodes
Access data from any previous node by name:
Node names must be in quotes inside brackets. Node names are case-sensitive and must match the exact name in your workflow.
$now — Current Timestamp
Access and format the current date/time using Luxon:
$env — Environment Variables
Access n8n environment variables:
Webhook Data Structure
The webhook node wraps all incoming request data:Common Patterns
Nested Fields
Combining Variables
Multi-Node Data Flow
When NOT to Use Expressions
- Code Nodes
- Webhook Paths
- Credential Fields
Data Type Handling
- Arrays
- Objects
- Strings
- Numbers
Advanced Patterns
Conditional Content
Date Manipulation
String Manipulation
Common Mistakes Quick Reference
Complete Error Catalog
Missing curly braces
Missing curly braces
Symptom: Field shows literal text like
$json.email instead of the actual value.Webhook body access
Webhook body access
Symptom: Undefined values when accessing webhook data even though the data is being sent.
Spaces in field names
Spaces in field names
Symptom: Syntax error or undefined when the field definitely exists.
Spaces in node names
Spaces in node names
Symptom: Error like
"Cannot read property 'Request' of undefined".Wrong node name case
Wrong node name case
Symptom: Undefined value even though the node exists and has data.
Double wrapping
Double wrapping
Symptom: Output shows
{{value}} instead of the actual value.Array access with dots
Array access with dots
Symptom: Syntax error or undefined.
Using = prefix outside JSON mode
Using = prefix outside JSON mode
Symptom: Output shows
=john@example.com instead of john@example.com.Missing .json in $node reference
Missing .json in $node reference
Symptom: Undefined value when you know the node has data.
Debugging Expressions
1
Open the expression editor
Click the field containing the expression, then click the fx icon to open the expression editor.
2
Check the live preview
The expression editor shows a live preview of the result. Check for values appearing as
undefined or error messages highlighted in red.3
Common error messages
- “Cannot read property ‘X’ of undefined” → Parent object doesn’t exist; check your data path
- “X is not a function” → Calling a method on the wrong type; check the variable type
- Expression shows as literal text → Missing
{{ }}; add curly braces
4
Follow the debugging checklist
- Is it wrapped in
{{ }}? - Is it webhook data? Add
.body - Does the field or node name have spaces? Use bracket notation
- Does the node name case match exactly?
- Is the property path correct? Check the data structure in the editor
- Is this inside a Code node? Remove
{{ }}
Expression Helper Reference
Best Practices
Do
- Always use
{{ }}for dynamic content - Use bracket notation for field names with spaces
- Access webhook data from
.body - Use
$nodeto reference data from earlier nodes - Test expressions in the expression editor
Don't
- Use
{{ }}inside Code nodes - Forget quotes around node names with spaces
- Double-wrap with extra
{{ }} - Assume webhook data is at the root
- Use expressions in webhook paths or credential fields