ν† . 8μ›” 16th, 2025

D: Handling complex data transformations in automation workflows can be challenging. But with n8n’s Set Node, you can manipulate, combine, and structure data like a pro! 🎯 In this guide, we’ll explore 10 practical use cases of the Set Node to supercharge your workflows.


πŸ”Ή What is the Set Node?

The Set Node in n8n allows you to:
βœ” Add, remove, or modify fields in your JSON data.
βœ” Merge multiple inputs into a single output.
βœ” Transform data structures for APIs, databases, or external tools.


πŸ›  10 Powerful Set Node Use Cases

1️⃣ Combine Data from Multiple Sources

Scenario: You want to merge customer details from a CRM (HubSpot) with order data (Shopify).

// Input 1 (CRM): { "name": "John Doe", "email": "john@example.com" }  
// Input 2 (Shopify): { "order_id": "12345", "product": "Laptop" }  

// Set Node Configuration:  
"Output": {  
  "customer": "={{ $input1.json.name }}",  
  "contact": "={{ $input1.json.email }}",  
  "purchase": "={{ $input2.json.product }}"  
}  

// Output:  
{ "customer": "John Doe", "contact": "john@example.com", "purchase": "Laptop" }  

2️⃣ Flatten Nested JSON for Simpler Processing

Scenario: You receive deeply nested API responses and need a cleaner format.

// Input: { "user": { "profile": { "name": "Alice", "age": 30 } } }  

// Set Node: Extract "name" and "age" to the root level.  
"Output": {  
  "name": "={{ $input.json.user.profile.name }}",  
  "age": "={{ $input.json.user.profile.age }}"  
}  

// Output: { "name": "Alice", "age": 30 }  

3️⃣ Add Conditional Fields

Scenario: Only include a “discount” field if the order total exceeds $100.

// Input: { "order_total": 150 }  

// Set Node:  
"Output": {  
  "total": "={{ $input.json.order_total }}",  
  "discount": "={{ $input.json.order_total > 100 ? '10%' : null }}"  
}  

// Output: { "total": 150, "discount": "10%" }  

4️⃣ Convert Data Types (String β†’ Number)

Scenario: An API returns numeric values as strings, but you need them as numbers.

// Input: { "price": "99.99" }  

// Set Node:  
"Output": {  
  "price": "={{ Number($input.json.price) }}"  
}  

// Output: { "price": 99.99 }  

5️⃣ Create Custom Error Messages

Scenario: Validate form submissions and return user-friendly errors.

// Input: { "email": "invalid-email" }  

// Set Node:  
"Output": {  
  "email": "={{ $input.json.email }}",  
  "error": "={{ !$input.json.email.includes('@') ? 'Invalid email format' : '' }}"  
}  

// Output: { "email": "invalid-email", "error": "Invalid email format" }  

6️⃣ Generate Dynamic Timestamps

Scenario: Log when a workflow runs with a timestamp.

// Set Node:  
"Output": {  
  "event": "Data processed",  
  "timestamp": "={{ new Date().toISOString() }}"  
}  

// Output: { "event": "Data processed", "timestamp": "2023-11-15T12:00:00Z" }  

7️⃣ Merge Arrays from Different Sources

Scenario: Combine two lists of products into one catalog.

// Input 1: { "products": ["Laptop", "Phone"] }  
// Input 2: { "items": ["Monitor", "Keyboard"] }  

// Set Node:  
"Output": {  
  "all_products": "={{ $input1.json.products.concat($input2.json.items) }}"  
}  

// Output: { "all_products": ["Laptop", "Phone", "Monitor", "Keyboard"] }  

8️⃣ Mask Sensitive Data

Scenario: Hide credit card numbers in logs.

// Input: { "card": "1234-5678-9012-3456" }  

// Set Node:  
"Output": {  
  "card": "={{ '****-****-****-' + $input.json.card.slice(-4) }}"  
}  

// Output: { "card": "****-****-****-3456" }  

9️⃣ Calculate Derived Values

Scenario: Compute tax based on subtotal.

// Input: { "subtotal": 200 }  

// Set Node:  
"Output": {  
  "subtotal": "={{ $input.json.subtotal }}",  
  "tax": "={{ $input.json.subtotal * 0.1 }}",  
  "total": "={{ $input.json.subtotal * 1.1 }}"  
}  

// Output: { "subtotal": 200, "tax": 20, "total": 220 }  

πŸ”Ÿ Rename Fields for Consistency

Scenario: Standardize keys before sending to a database.

// Input: { "FirstName": "Emma", "user_age": 28 }  

// Set Node:  
"Output": {  
  "name": "={{ $input.json.FirstName }}",  
  "age": "={{ $input.json.user_age }}"  
}  

// Output: { "name": "Emma", "age": 28 }  

πŸŽ‰ Final Tips for Set Node Mastery

βœ… Use JavaScript expressions (={{ }}) for dynamic values.
βœ… Test transformations with the “Execute Node” button.
βœ… Combine with other nodes like Function or IF for advanced logic.

With these 10 Set Node techniques, you can handle almost any data transformation in n8n! πŸš€ Which one will you try first?


πŸ’¬ Let’s Discuss! Have a unique Set Node use case? Share it in the comments! πŸ‘‡

λ‹΅κΈ€ 남기기

이메일 μ£Όμ†ŒλŠ” κ³΅κ°œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. ν•„μˆ˜ ν•„λ“œλŠ” *둜 ν‘œμ‹œλ©λ‹ˆλ‹€