⚠️ Malware / Trojaner / VirenWindows 11: Microsoft entfernt WMIC-Tool gegen Ransomware - ad-hoc-news.de(14.09.2026 um 07:58 Uhr)
🕵️ SicherheitslückenMicrosoft schließt Rekordzahl an Sicherheitslücken - techbook(14.09.2026 um 09:00 Uhr)
🪟 Windows ServerPC-COLLEGE: Tipp 383: Nachlese IFA 2026 in Berlin - MÖBELMARKT(14.09.2026 um 11:47 Uhr)
🤖 Android TippsSamsung knöpft sich die AirPods Max von Apple vor(14.09.2026 um 12:49 Uhr)
🪟 Windows TippsGoogle Gemini: Neue Windows-App holt die KI aus dem Browser(14.09.2026 um 06:00 Uhr)
🤖 Android TippsSamsung plant Preiserhebung im Galaxy-Ökosystem(14.09.2026 um 13:00 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11: Microsoft entfernt WMIC-Tool gegen Ransomware - ad-hoc-news.de(14.09.2026 um 07:58 Uhr)
🕵️ SicherheitslückenMicrosoft schließt Rekordzahl an Sicherheitslücken - techbook(14.09.2026 um 09:00 Uhr)
🪟 Windows ServerPC-COLLEGE: Tipp 383: Nachlese IFA 2026 in Berlin - MÖBELMARKT(14.09.2026 um 11:47 Uhr)
🤖 Android TippsSamsung knöpft sich die AirPods Max von Apple vor(14.09.2026 um 12:49 Uhr)
🪟 Windows TippsGoogle Gemini: Neue Windows-App holt die KI aus dem Browser(14.09.2026 um 06:00 Uhr)
🤖 Android TippsSamsung plant Preiserhebung im Galaxy-Ökosystem(14.09.2026 um 13:00 Uhr)

🔧 Programmierung 🕛 vor 2 Monaten 4 Min Lesezeit
0

n8n Expressions: How to Use Dynamic Data in Your Workflows (Free Examples)

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

If you have ever copy-pasted the same value into a dozen nodes, you already know the pain. n8n expressions are the fix. They let you pull live data from any previous node, do math, format dates, and build strings in any field in your workflow.



This post covers everything you need to get moving: syntax, the most useful built-in variables, and real-world examples you can drop into your own workflows.









What Is an n8n Expression?



An expression is JavaScript wrapped in double curly braces.

Whenever n8n sees those braces in a field, it evaluates what is inside and uses the result.



Example: {{ $json.email }} grabs the email field from the current item. No node. No extra step. Just live data.







How to Open the Expression Editor




  1. Hover over any input field in a node.

  2. Click the = icon that appears on the right.

  3. The field turns purple, you are now in expression mode.

  4. Type your expression. The preview pane at the bottom shows the live result.







The Core Variables



$json - current item data





  • $json.name - simple field


  • $json.order.total - nested field


  • $json.items[0].sku - array element



$json is the data object of the current item being processed.



$('Node Name').item.json - data from a specific node



Pull data from any previous node by name. This is the most powerful pattern.



Example: $('HTTP Request').item.json.id or $('Get User').item.json.profile.avatar_url



$now - current timestamp (Luxon DateTime)





  • $now.toISO() - full ISO string


  • $now.toFormat('yyyy-MM-dd') - formatted date


  • $now.minus({ days: 7 }).toISO() - one week ago



$vars - workflow variables (n8n 1.x+)



Set static values once in Settings > Variables and reference them everywhere.




  • $vars.SLACK_CHANNEL

  • $vars.API_BASE_URL



$env - environment variables (self-hosted only)




  • $env.MY_SECRET_KEY







JavaScript Is Fair Game



Everything inside {{ }} is evaluated as JavaScript:




CODE
// String methods
{{ $json.name.toUpperCase() }}
{{ $json.email.split('@')[0] }}

// Ternary
{{ $json.status === 'active' ? 'Active' : 'Inactive' }}

// Math
{{ $json.price * 1.2 }}

// Array length
{{ $json.items.length }}












Practical Examples



1. Dynamic email subject



Order confirmed for {{ $json.customer_name }}



2. Format date for Google Sheets



{{ $now.toFormat('MM/dd/yyyy') }}



3. Combine names



{{ $json.first_name + ' ' + $json.last_name }}



4. Safely handle a missing field



{{ $json.middle_name ?? 'N/A' }}



The ?? nullish coalescing operator returns N/A if the field is null or undefined.



5. Pull data from a different branch



In a Merge node after two parallel branches:




CODE
Customer: {{ $('Get Customer').item.json.name }}
Order total: {{ $('Get Order').item.json.total }}






6. Build a URL dynamically




CODE
https://api.example.com/users/{{ $json.user_id }}/orders/{{ $json.order_id }}






Paste directly into the URL field of an HTTP Request node.









Common Mistakes
































Mistake Fix

json.name missing $
Use $json.name
Spaces inside braces
{{ $json.name }} not { {$json.name} }
Wrong node name casing Names are case-sensitive
Array without index Use $json.items[0] not $json.items
Expression in static field Click = icon to switch to expression mode








Free Workflow JSON



Here is a minimal workflow demonstrating four expression patterns - dynamic URL, formatted date, ternary condition, and name concat:




CODE
{
"name": "n8n Expressions Demo",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [240, 300]
},
{
"parameters": {
"values": {
"string": [
{ "name": "user_id", "value": "42" },
{ "name": "status", "value": "active" },
{ "name": "first_name", "value": "Ada" },
{ "name": "last_name", "value": "Lovelace" }
]
}
},
"name": "Set Sample Data",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [460, 300]
},
{
"parameters": {
"values": {
"string": [
{ "name": "full_name", "value": "={{ $json.first_name + ' ' + $json.last_name }}" },
{ "name": "api_url", "value": "=https://api.example.com/users/{{ $json.user_id }}" },
{ "name": "label", "value": "={{ $json.status === 'active' ? 'Active' : 'Inactive' }}" },
{ "name": "today", "value": "={{ $now.toFormat('yyyy-MM-dd') }}" }
]
}
},
"name": "Build Expressions",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [680, 300]
}
],
"connections": {
"Start": { "main": [[{ "node": "Set Sample Data", "type": "main", "index": 0 }]] },
"Set Sample Data": { "main": [[{ "node": "Build Expressions", "type": "main", "index": 0 }]] }
}
}






Import it into n8n, run it once, and inspect the output of Build Expressions to see all four patterns live.









Want More Ready-to-Run Workflows?



The patterns above power every automation I build. If you want a full library of production-ready workflows - error handling, webhooks, Stripe receipts, CRM sync, and more - I packaged them into the n8n Workflow Starter Pack ($29).



One purchase, instant download, no subscription.









Quick Reference












































Variable What it gives you
$json.field Field from the current item
$('Node Name').item.json.field Field from a named previous node
$now Current time (Luxon DateTime)
$vars.NAME Workflow variable
$env.NAME Environment variable (self-hosted)
$input.all() All items entering the current node
$input.first().json First item only
$input.last().json Last item only


Expressions unlock the difference between a rigid script and a truly dynamic workflow. Once they click, you will use them in every single node.



Drop a question below if you get stuck on a specific expression - happy to help debug it.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
6 Quellen
CVE-2026-89613 | Linux Kernel up to 7.2.3 ntfs input validation (Nessus ID 345345)
5 Quellen
CVE-2026-87431 | Google Chrome up to 152.0.7977.82 Extensions improper authorization (WID-SEC-2026-3238)
2 Quellen
CVE-2026-49853 | tornadoweb Tornado up to 6.5.5 Redirect redirect (Nessus ID 345570)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten n8n Expressions: How to Use Dynamic Data in Your Workflows (Free Examples)

Thematisch verwandte Begriffe: Expressions, Dynamic, Data, Your · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...