Data Iteration and Looping Logic for Beginners - n8n Workflow

Master fundamental n8n iteration logic using this comprehensive n8n workflow. Learn how to handle arrays, split data, and control loops using the Split Out and Loop Over Items n8n node to build robust n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • New n8n users trying to understand how data items are processed.

  • Automation developers struggling with array handling and bulk operations.

  • Anyone needing robust examples of the Loop Over Items n8n node.

  • Users looking for foundational n8n templates focusing on core logic.

Overview

Understanding how n8n handles multiple pieces of data—known as 'items'—is crucial for building reliable automations. This specialized n8n workflow provides a side-by-side comparison of three common iteration scenarios, ensuring that beginners grasp core concepts like built-in iteration vs. explicit looping. Many new users encounter issues when an array is treated as a single item instead of being processed individually. This educational n8n template demonstrates the difference between processing an unsplit array (Path A), using a Split Out n8n node to enable item-by-item processing (Path C), and how to disable iteration entirely (Path C3). By using this n8n workflow, you gain clarity on flow control and data preparation, which are essential skills for any serious n8n automation specialist.

How it Works

This comprehensive n8n workflow starts with a Manual Trigger n8n trigger, configured to simulate input data (an array of five URLs).


  1. Manual Trigger Start: The execution begins when the user manually runs the workflow, providing a JSON object containing a list of URLs.

  2. Path A: Unsplit Array Processing (Loop 1): The raw input data (the entire array as a single item) is sent to the ‘Loop over Items 1’ n8n node. Because the array was not split, the loop treats the entire payload as one unit, which is modified by a Code n8n node and displayed in ‘Result1’.

  3. Path B: Direct Code Processing (Run Once Implicitly): A parallel path sends the unsplit array to ‘Add param1 to output5’ (a Code n8n node). Since iteration is not forced, the code runs once over the entire item, demonstrating that the data remains consolidated, visible in ‘Result5’.

  4. Path C: Controlled Split and Iteration: The main control path involves the ‘Split Array of Strings into Array of Objects’ n8n node. This crucial step converts the five URLs from a single array into five separate n8n items. This split data then proceeds through three sub-paths:

C1 (Explicit Loop): The items enter ‘Loop over Items 2’, which processes each item sequentially. A ‘Wait one second’ n8n node is included to visibly demonstrate the sequential execution of the loop, resulting in separate outputs displayed in ‘Result2’.
C2 (Built-in Iteration): The split items are processed by the ‘Add param1 to output3’ Code n8n node. This demonstrates n8n's default behavior where standard nodes iterate over all available items, visible in ‘Result3’.
* C3 (Disable Iteration): The split items are processed by the ‘Add param1 to output4’ Code n8n node, which is configured to ‘Run Once For All Items’, showing how to consolidate or batch process multiple items into a single run, displayed in ‘Result4’. This entire n8n workflow provides excellent visual diagnostics for looping.

Installation Guide

To use this educational n8n workflow template, follow these steps:


  1. Import the JSON: Copy the provided n8n workflow JSON code.

  2. In your n8n instance, navigate to 'Workflows', click 'New', and select 'Import from JSON'. Paste the code.

  3. Setup Data Input: The workflow uses a Manual Trigger n8n trigger named 'Paste JSON into this node'.

  4. Double-click the 'Paste JSON into this node' n8n node.

  5. Click the 'Edit Output' button (located in the top-right corner of the node settings).

  6. Paste the following sample JSON data and save the output:

{
"urls": [
"https://www.reddit.com",
"https://www.n8n.io/",
"https://n8n.io/",
"https://supabase.com/",
"https://duckduckgo.com/"
]
}

  1. The n8n trigger will turn purple, indicating pinned test data. You can now run the n8n workflow to observe the different looping behaviors in the 'Result' n8n node outputs.

Node Details

Manual Trigger (Paste JSON into this node): The starting n8n trigger. Used to initiate the flow and provide the initial test data (an array of URLs) for the demonstration.
Split Out (Split Array of Strings into Array of Objects): This crucial n8n node takes the input array (urls) and splits it into individual JSON objects. This is necessary to enable item-by-item looping in the subsequent steps.
Loop over Items 1 & 2: An essential flow control n8n node. This node controls the execution of a set of downstream nodes and determines if execution loops or runs once. Loop 1 demonstrates processing an unsplit array (runs once); Loop 2 demonstrates processing a split array (runs once per item).
Code Nodes (Add param1 to outputX): Multiple Code n8n node instances are used to modify the incoming data by adding a parameter (param1). These are key for visualizing how many times the code executes based on the preceding iteration logic.
Wait (Wait one second): A simple n8n node used in Path C1 to introduce a 1-second delay per item, making the sequential nature of the loop execution visible to the user.
NoOp Nodes (Result1, Result2, etc.): These simple n8n node instances act as inspection points, allowing the user to view the final output data structure at different stages of the n8n workflow.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by
Dominik Baranowski
Dominik Baranowski

Featured*