n8n-expression-syntax
🤖 AI Summary
The n8n-expression-syntax skill provides developers with the correct syntax rules for writing dynamic expressions in n8n workflows, including how to use double curly braces (`{{ }}`) and the core variables `$json` (current node output) and `$node` (data from other nodes).
How to Install
Claude Code:
git clone --depth 1 https://github.com/czlonkowski/n8n-skills.git && cp n8n-skills/skills/n8n-expression-syntax ~/.claude/skills/n8n-expression-syntax -r# n8n Expression Syntax
Expert guide for writing correct n8n expressions in workflows.
---
## Expression Format
All dynamic content in n8n uses **double curly braces**:
```
{{expression}}
```
**Examples**:
```
✅ {{$json.email}}
✅ {{$json.body.name}}
✅ {{$node["HTTP Request"].json.data}}
❌ $json.email (no braces - treated as literal text)
❌ {$json.email} (single braces - invalid)
```
---
## Core Variables
### $json - Current Node Output
Access data from the current node:
```javascript
{{$json.fieldName}}
{{$json['field with spaces']}}
{{$json.nested.property}}
{{$json.items[0].name}}
```
### $node - Reference Other Nodes
Access data from any previous node:
```javascript
{{$node["Node Name"].json.fieldName}}
{{$node["HTTP Request"].json.data}}
{{$node["Webhook"].json.body.email}}
```
**Important**:
- Node names **must** be in quotes
- Node names are **case-sensitive**
- Must match exact node name from workflow
### $now - Current Timestamp
Access current date/time:
```javascript
{{$now}}
{{$now.toFormat('yyyy-MM-dd')}}
{{$now.toFormat('HH:mm:ss')}}
{{$now.plus({days: 7})}}
```
### $env - Environment Variables
Access environment variables:
```javascript
{{$env.API_KEY}}
{{$env.DATABASE_URL}}
```
**Warning**: Some n8n instances have `N8N_BLOCK_ENV_ACCESS_IN_NODE` enabled, which blocks `$env` access entirely. If `$env` returns errors, use alternative approaches:
- Store values in credentials instead
- Use a Set node with manually entered values
- Pass values through webhook query parameters
---
## 🚨 CRITICAL: Webhook Data Structure
**Most Common Mistake**: Webhook data is **NOT** at the root!
### Webhook Node Output Structure
```javascript
{
"headers": {...},
"params": {...},
"query": {...},
"body": { // ⚠️ USER DATA IS HERE!
"name": "John",
"email": "john@example.com",
"message": "Hello"
}
}
```
### Correct Webhook Data Access
```javascript
❌ WRONG: {{$json.name}}
❌ WRONG: {{$json.email}}
✅ CORRECT: {{$json.body.name}}
✅ CORRECT: {{$json.body.email}}
✅ CORRECT: {{$json.body.message}}
```
**Why**: Webhook node wraps incoming data under `.body` property to preserve headers, params, and query parameters.
---
## Common Patterns
### Access Nested Fields
```javascript
// Simple nesting
{{$json.user.email}}
// Array access
{{$json.data[0].name}}
{{$json.items[0].id}}
// Bracket notation for spaces
{{$json['field name']}}
{{$json['user data']['first name']}}
```
### Reference Other Nodes
```javascript
// Node without spaces
{{$node["Set"].json.value}}
// Node with spaces (common!)
{{$node["HTTP Request"].json.data}}
{{$node["Respond to Webhook"].json.message}}
// Webhook node
{{$node["Webhook"].json.body.email}}
```
### Combine Variables
```javascript
// Concatenation (automatic)
Hello {{$json.body.name}}!
// In URLs
https://api.example.com/users/{{$json.body.user_id}}
// In object properties
{
"name": "={{$json.body.name}}",
"email": "={{$json.body.email}}"
}
```
---
## When
Details
| Category | Data → data_proc |
| Source | czlonkowski/n8n-skills |
| SKILL.md | View on GitHub → |
| Repo Stars | ★ 5.5K |
| Est. per Skill | 369 (shared across 15 skills from this repo) |
| Difficulty | Intermediate |
| Risk Level | N/A |
Related Skills
langfuse
Langfuse Expert in Langfuse - the open-source LLM observability platform. Covers tracing, prompt man
wordpress-centric-high-seo-optimized-blogwriting-skill
WordPress SEO Blog Writing Skill Overview This skill enables Senior Content Strategists and Expert C
base
LibreOffice Base Overview LibreOffice Base skill for creating, managing, and automating database wor
calc
LibreOffice Calc Overview LibreOffice Calc skill for creating, editing, converting, and automating s
Works Well With
Skills from the same repository — often designed to work together
n8n-code-javascript
JavaScript Code Node Expert guidance for writing JavaScript code in n8n Code nodes. --- Quick Start
n8n-code-python
Python Code Node (Beta) Expert guidance for writing Python code in n8n Code nodes. --- ⚠️ Important:
n8n-code-tool
n8n Custom Code Tool Expert guidance for writing code inside @n8n/n8n-nodes-langchain.toolCode — the