Split out top level array in to separate items

Describe the issue/error/question

I have a workflow in which I have split out an API response in to individual items. I am then calling another API for each of the individual items. The response looks like this:

[
   {
      "totalCount":1,
      "hasMore":false,
      "firstIndex":0,
      "list":[
         {
            "id":"009c84bb-0c55-4dcd-b639-dd7a627e7da7",
            "name":"Plaza BDC"
         }
      ]
   },
   {
      "totalCount":1,
      "hasMore":false,
      "firstIndex":0,
      "list":[
         {
            "id":"6f00f5d5-5b0e-4127-9075-9522681a0d3a",
            "name":"Battersea"
         }
      ]
   },
   {
      "totalCount":1,
      "hasMore":false,
      "firstIndex":0,
      "list":[
         {
            "id":"d158a688-9b64-4186-ae78-18d42a8103fe",
            "name":"StJamesSquare"
         }
      ]
   },
   {
      "totalCount":2,
      "hasMore":false,
      "firstIndex":0,
      "list":[
         {
            "id":"101f4571-2465-4e31-ab42-ed0cefbe2fd7",
            "name":"Edinburgh"
         },
         {
            "id":"a89b0ed4-5206-4cc9-8298-d982ebb7bf92",
            "name":"Minster Building"
         }
      ]
   },
   {
      "totalCount":1,
      "hasMore":false,
      "firstIndex":0,
      "list":[
         {
            "id":"7bc0e0fe-c7e5-4312-95bc-28a38b487fb8",
            "name":"Alexandra Surgery"
         }
      ]
   },
   {
      "totalCount":12,
      "hasMore":false,
      "firstIndex":0,
      "list":[
         {
            "id":"6743be74-11ce-4945-baa6-6d5562a837fc",
            "name":"Reference Point"
         },
         {
            "id":"4ce6ef1b-4ac8-4a68-8ae6-2790b2512003",
            "name":"Central 1st Flr"
         },
         {
            "id":"11efa3f4-b0a6-44f2-99a8-865e40b656bf",
            "name":"Ikoyi"
         },
         {
            "id":"346c4ba2-2eba-4d16-8a79-0c9fdee130ae",
            "name":"Health Spa"
         },
         {
            "id":"bc6d2c09-b697-4543-bf3d-5024b9587684",
            "name":"Exhibition Space"
         },
         {
            "id":"11421c95-c395-4931-ad0d-12bc937fa2b8",
            "name":"7th Floor"
         },
         {
            "id":"bb069b7b-af01-4a0c-a265-cc5e009aa9e2",
            "name":"Surrey 2nd Floor"
         },
         {
            "id":"2027d6c7-e149-461d-8e0b-3d74e867ae6e",
            "name":"Arundel 1st Flr"
         },
         {
            "id":"d2f2a8d4-e75b-496f-b0d0-7fb521c69f1e",
            "name":"1st floor Surrey"
         },
         {
            "id":"7bcbcfd7-8a54-4726-aed3-95fb30402f68",
            "name":"6th Floor"
         },
         {
            "id":"144ca431-0dd8-438e-8668-ebed56e2e7aa",
            "name":"Lower Ground 2"
         },
         {
            "id":"6bd55dc1-f9cf-4ff2-bad6-5b46872190f2",
            "name":"8th Floor"
         }
      ]
   }
]

As you can see, each object in the parent array contains it’s own array called ‘list’. I want to use each of these lists individually in my next step. How do I split out from here so I can run the next step once for each of these lists?

Thanks in advance,
Jonathan

What is the error message (if any)?

Please share the workflow

Information on your n8n setup

  • n8n version: Azure AKS Latest Version
  • Database you’re using (default: SQLite): Postgres
  • Running n8n with the execution process [own(default), main]: Not sure what this means
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Azure AKS / Kubernetes

Hi @JNathanson, I am not sure I fully understand the problem. Do you want to execute an HTTP Request request for each of the items in all of your list fields? So for 18 items in total when looking at your example data?

It seems to me your existing workflow would do that, so perhaps you can describe which problem exactly you are seeing.

Hi @MutedJam

Thanks for your response. I figured it out after I posted. I think the confusion came in that when you view the execution of the split items node, it grouped each list together (where in the source data there were multiple arrays called “list”).

Thank you for your help

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.