Split an Array into Individual Items in n8n

Difficulty
1/10
Tags
EssentialsSplit OutHTTP RequestArraysData Transformation

APIs often return data as an array nested inside a response object. For example, { "results": [...] } instead of just [...]. When this happens, n8n treats the entire response as a single item.

The Split Out node takes a nested array field and outputs each element as its own item. This is essential when you want to process each item separately, like sending individual notifications or updating records one by one.

In this challenge, you'll fetch multiple random users from an API and split them into individual items for processing.

What you'll practice:

  • Using the Split Out node to separate array items
  • Understanding how n8n processes multiple items
  • Specifying which field contains the array to split

Your Task

Fetch 5 random users from https://randomuser.me/api/?results=5 and split the results array so each user becomes a separate item.

The API returns an object with a results array containing 5 users. Without splitting, n8n sees this as 1 item. After splitting, your workflow should output 5 individual items.

Input (1 item with nested array):

{
  "results": [
    { "name": { "first": "John", "last": "Doe" }, "email": "john@example.com" },
    { "name": { "first": "Jane", "last": "Smith" }, "email": "jane@example.com" }
  ],
  "info": { "results": 5 }
}

Expected output (5 separate items):

Item 1: { "name": { "first": "John", "last": "Doe" }, "email": "john@example.com" }
Item 2: { "name": { "first": "Jane", "last": "Smith" }, "email": "jane@example.com" }

Paste into n8n with Ctrl+V

Hints

  1. Add a Manual Trigger node to start the workflow
  2. Add an HTTP Request node to fetch from the URL above
  3. Add a Split Out node after the HTTP Request
  4. In the Split Out node, set Field To Split Out to results

Tip: Run the HTTP Request node first and look at the output - you'll see 1 item containing a results array. After adding Split Out, you'll see 5 items.

Explanation

Why we need Split Out:

When the HTTP Request node fetches from the API, it returns a single object that contains an array inside the results field. n8n sees this as 1 item, not 5. If you connected a Slack node after the HTTP Request, it would only run once, not once per user.

The Split Out node solves this by extracting each element from the results array and outputting them as separate items. Now any node connected after Split Out runs 5 times, once per user.

How the solution works:

  1. Manual Trigger: Starts the workflow when you click "Execute"
  2. HTTP Request: Fetches the API response (1 item containing results array with 5 users)
  3. Split Out: Configured with fieldToSplitOut: "results" to extract each user from that array

The include option in Split Out controls whether to keep other fields from the original object (like info). Setting it to empty means only the array contents are output, giving you clean user objects without the wrapper.

Copy the Solution

Click below to copy the solution workflow to your clipboard. Then open n8n and press Ctrl+V anywhere on the canvas to paste it.

Login to see the exercise

Create an account to access challenges and track your progress.

Log in to see exercise