How to Split Array into Items in n8n: The 2026 Master Guide π
In the evolving world of workflow automation, the ability to manipulate data structures efficiently is what separates a novice from a master. If you have ever found yourself staring at a massive JSON response from an API, wondering how to process each entry individually, you have encountered the classic “array problem.” Today, we are going to master how to split array into items in n8n so you can build scalable, high-performance automations.
Understanding the Array: The Box of Legos π§±
Imagine you receive a delivery at your warehouse. Inside a single large box, there are fifty smaller boxes of Legos. If you want to build fifty different models, you can’t work on them while they are all stuck inside that one big box. You need to take them out and place them individually on your workbench. This is exactly what we do when we split array into items in n8n.
In technical terms, an array is a single data structure (the big box) containing multiple elements (the Lego sets). By default, n8n nodes process “items” one by one. If an API returns an array inside a single item, most subsequent nodes will only run once on that entire collection. To make n8n run a node fifty timesβonce for each Lego setβwe must split that array into individual items.
Table of Contents π
- Why Splitting is Essential for Automation
- The Modern Approach: The Split Out Node
- The Developer Approach: Using the Code Node
- Comparison Table: Methods Overview
- How to Use It Properly (Step-by-Step)
- Tips and Tricks for 2026
- Frequently Asked Questions
Why Splitting is Essential for Automation βοΈ
In n8n, “Items” are the currency of your workflow. Every time a node executes, it looks at the incoming stream of items. If you have an array containing 1,000 customers but it is currently formatted as a single item, your “Send Email” node will only trigger once, likely failing because it doesn’t know which email address to use.
When you split array into items in n8n, you transform that single item into 1,000 individual items. Now, n8n will loop through your “Send Email” node 1,000 times, once for each unique customer. This granular control is vital for error handling, data transformation, and integrating with third-party tools like Google Sheets or Slack.
The Modern Approach: The Split Out Node β‘
In 2026, the primary way to handle this task is via the Split Out node. This node is designed specifically for this purpose and handles the heavy lifting without requiring you to write a single line of JavaScript. It is the “easy button” for data transformation.
You simply point the node to the field containing your array (e.g., results or data.users), and n8n automatically explodes that array into separate items. It even keeps the context of other fields if you configure it correctly, ensuring no data is lost in the process.
The Developer Approach: Using the Code Node π»
While the Split Out node is fantastic, sometimes you need surgical precision. Perhaps you need to filter the data, rename keys, or perform calculations while you are splitting the array. This is where the Code Node shines. It allows you to use standard JavaScript to manipulate your data stream.
Below is a perfectly functional snippet for the Code Node in 2026. This script takes an array from an input field and converts it into the standard n8n item format.
// This script assumes the previous node sent an object containing an array called 'myList'
// We will use the .map() function, which is like a specialized factory worker
// that visits every element in your array and prepares it for the next step.
const arrayToSplit = $input.item.json.myList;
// We return an array of objects.
// Each object MUST have a 'json' property for n8n to recognize it as an item.
return arrayToSplit.map(element => {
return {
json: {
// We spread the original element properties
...element,
// We can also add a timestamp or extra data here
processedInN8n: true,
currentYear: 2026
}
};
});
This code acts like a custom-built conveyor belt. It takes your raw list, wraps each individual piece of data in a specific “n8n-ready” envelope (the json key), and sends it down the line. It is highly efficient and offers maximum flexibility for complex workflows.
Comparison Table: Methods Overview π
| Feature | Split Out Node | Code Node (JS) |
|---|---|---|
| Ease of Use | βββββ (No code) | βββ (Requires JS) |
| Flexibility | βββ (Fixed logic) | βββββ (Unlimited) |
| Speed | Fastest Setup | Fastest Execution |
| Error Handling | Standard | Customizable |
How to Use It Properly (Step-by-Step) π οΈ
- Identify the Array: Look at your input data in the “Table” or “JSON” view. Find the key that holds the list (e.g.,
rows,items, ordata). - Add the Split Out Node: Search for “Split Out” in the node selector.
- Select the Field: In the node settings, type the name of the field you identified in step 1. You don’t need the full path if you are using the built-in selector.
- Test the Output: Click “Execute Node.” You should see the number of items in the output header increase from “1 Item” to the total count of elements in your array.
- Connect the Next Node: Now, any node you connect (like a Discord or Email node) will run once for every single item produced.
Tips and Tricks for 2026 π‘
- Avoid Memory Overload: If you are splitting an array with 50,000+ items, consider using the “Wait” node or processing in batches to prevent your n8n instance from running out of RAM.
- Check for Nulls: Always ensure the field you are splitting actually contains an array. If the field is undefined, the workflow might throw an error. Use an “If” node or optional chaining in JS to be safe.
- Use Emojis for Logs: When processing items in a loop, adding emojis to your log messages makes debugging in the Execution list much faster! π
Pros and Cons βοΈ
Pros
- Enables powerful 1-to-N automation patterns.
- Crucial for mapping data to databases or spreadsheets.
- Improves workflow readability by separating concerns.
Cons
- Can increase execution time if the array is extremely large.
- Each item counts towards your execution limit on n8n Cloud.
Frequently Asked Questions β
Q: Can I split more than one array at once?
A: Technically, n8n processes one array per “Split Out” operation. If you have nested arrays, you may need to chain two Split Out nodes together.
Q: Why did my workflow stop after splitting?
A: Ensure that the nodes following the split are not “Batch” nodes that might be waiting for all items to finish before moving on. Check your node connections!
Q: What if my data isn’t in an array format?
A: You must first convert your data into an array using a Code node or the “Edit Fields” node before you can split array into items in n8n.
Conclusion: Master Your Data Streams π
Learning how to split array into items in n8n is a foundational skill that unlocks the true potential of automation. Whether you use the user-friendly Split Out node or the powerful custom Code node, you now have the tools to handle any data structure that comes your way. Remember to always validate your input data and consider performance when dealing with massive datasets. With these techniques in your arsenal, your 2026 workflows will be faster, leaner, and more reliable than ever before.
Ready to take your automation skills to the next level? Explore more guides and tutorials at n8nnode.com.