Skip to main content

n8n Expression Syntax

All dynamic content in n8n uses double curly braces:
Webhook data is NOT at the root of $json.Webhook nodes wrap all incoming data under a .body property. Always access webhook fields as {{$json.body.fieldName}}, never {{$json.fieldName}}.

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:
In a Slack node text field after a Webhook:

Common Patterns

Nested Fields

Combining Variables

Multi-Node Data Flow

When NOT to Use Expressions

Do not use {{}} expressions inside Code nodes. Code nodes use direct JavaScript/Python — the {{}} syntax is for expression fields in other node types only.

Data Type Handling

Advanced Patterns

Conditional Content

Date Manipulation

String Manipulation

Common Mistakes Quick Reference

Complete Error Catalog

Symptom: Field shows literal text like $json.email instead of the actual value.
Symptom: Undefined values when accessing webhook data even though the data is being sent.
Symptom: Syntax error or undefined when the field definitely exists.
Symptom: Error like "Cannot read property 'Request' of undefined".
Symptom: Undefined value even though the node exists and has data.
Symptom: Output shows {{value}} instead of the actual value.
Symptom: Syntax error or undefined.
Symptom: Output shows =john@example.com instead of john@example.com.
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

  1. Is it wrapped in {{ }}?
  2. Is it webhook data? Add .body
  3. Does the field or node name have spaces? Use bracket notation
  4. Does the node name case match exactly?
  5. Is the property path correct? Check the data structure in the editor
  6. 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 $node to 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