# Remove array inside another array

**URL:** <https://community.n8n.io/t/remove-array-inside-another-array/2498>\
**Category:** Questions\
**Tags:** data-transformation\
**Created:** [September 30, 2020, 1:55am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498 "2020-09-30T01:55:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![gnik31](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@gnik31](https://community.n8n.io/u/gnik31)\
**Post date:** [September 30, 2020, 1:55am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/1 "2020-09-30T01:55:09Z")

</div>

Hi there! Just curious on how can I remove an array inside an array? I am trying to make this:

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/d/d4538a7bd2ab1337da3db68fdf9f384bde526778.png)  
only look like this:  
 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/6/6ab90b7d1e5487d04c22788548e469851a1ef9b5.png)  
Thanks!

---

<div class="post-metadata">

**Author:** ![gnik31](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@gnik31](https://community.n8n.io/u/gnik31)\
**Post date:** [September 30, 2020, 2:14am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/2 "2020-09-30T02:14:44Z")

</div>

because as of now it looks like this when i am trying to access the data:

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/d/d3eaa8373bed87f00e0eea16ef5a88ced00c1423.png)  
but i want it to be like this:  
 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/e/ea270ffaae42d89cb9d9b09e6837e5c2650e4049.png)  
just so i could transfer the data to mysql node easily  
Thanks!

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [September 30, 2020, 7:28am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/3 "2020-09-30T07:28:17Z")

</div>

Hey @gnik31!

You can use the [Function node](https://docs.n8n.io/nodes/n8n-nodes-base.function/#function) for that. Note that the Function node returns an array. Sharing a code snippet with you that might help

```nohighlight
var newArr = []
// code to transform/extract the data
newArr.push({json: {Key1: value1, Key2: value2}})

return newArr

```

Please let us know if you have any other questions. You can read more about the data structure in n8n [here](https://docs.n8n.io/reference/data/data-structure.html#data-structure)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![gnik31](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@gnik31](https://community.n8n.io/u/gnik31)\
**Post date:** [September 30, 2020, 7:48am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/4 "2020-09-30T07:48:51Z")

</div>

Will try this @harshil1712! Thank you so much!

---

<div class="post-metadata">

**Author:** ![gnik31](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@gnik31](https://community.n8n.io/u/gnik31)\
**Post date:** [September 30, 2020, 8:05am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/5 "2020-09-30T08:05:38Z")

</div>

Made it! Thank you so much! @harshil1712

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/0/0758c2d7908f74829020d202df6419837615cae3.png)

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [September 30, 2020, 8:39am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/6 "2020-09-30T08:39:06Z")

</div>

Awesome! I am glad it is solved!

Have fun!

---

<div class="post-metadata">

**Author:** ![MarkLL](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MarkLL](https://community.n8n.io/u/MarkLL)\
**Post date:** [August 26, 2021, 5:46am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/7 "2021-08-26T05:46:27Z")

</div>

Hi, sorry I’m new to n8n and TS as a language… I can not get an array of items out; similar but slightly different because I have multiple items.  
e.g.

```auto
[
  [
    {
      "Key": "ec37c11e-2b67-49c6-8a58-6eccb7dd75ee",
      "Name": "Customer"
    },
    {
        "Key": "0dbdbf8a-d80c-48e6-b453-bb7862445b7c",
        "Name": "InventoryItem"
    },
    {
        "Key": "6d2dc48d-2053-4e45-8330-285ebd431242",
        "Name": "Supplier"
    },
    {
        "Key": "dcb382dc-a4e0-4354-a845-b7d647f610f7",
        "Name": "CustomField"
    }
  ]
]

```

I’ve been trying to go over the documentation but there are a few 404’s when important. e.g. as in " Information about how the data is structured can be found on [this](https://docs.n8n.io/getting-started/key-concepts.html#data-structure) page about data structures."

---

<div class="post-metadata">

**Author:** ![MarkLL](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MarkLL](https://community.n8n.io/u/MarkLL)\
**Post date:** [August 26, 2021, 6:11am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/8 "2021-08-26T06:11:40Z")

</div>

Ok so this is what ended up working to structure it how I needed it…

```auto
const newItems = [];

var max = $node["HTTP Request"].json.length;
for (let i=0;i<max;i++) {
  newItems.push({json:{ key: $node["HTTP Request"].json[i]["Key"], Name: $node["HTTP Request"].json[i]["Name"]}});
}

return newItems;

```

I’m sure this could be cleaner…

---

<div class="post-metadata">

**Author:** ![sirdavidoff](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirdavidoff/32/2423_2.png) [@sirdavidoff](https://community.n8n.io/u/sirdavidoff)\
**Post date:** [August 26, 2021, 7:19am UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/9 "2021-08-26T07:19:18Z")

</div>

We have a new node that we’re putting the finishing touches to that will do exactly this.

---

<div class="post-metadata">

**Author:** ![hasanm](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hasanm](https://community.n8n.io/u/hasanm)\
**Post date:** [May 25, 2023, 4:38pm UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/10 "2023-05-25T16:38:31Z")

</div>

> [@sirdavidoff](#):
>
> touches

Hi  
what is the node name ?

---

<div class="post-metadata">

**Author:** ![sirdavidoff](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirdavidoff/32/2423_2.png) [@sirdavidoff](https://community.n8n.io/u/sirdavidoff)\
**Post date:** [May 25, 2023, 7:48pm UTC](https://community.n8n.io/t/remove-array-inside-another-array/2498/11 "2023-05-25T19:48:59Z")

</div>

The ‘split out items’ operation of the ‘item lists’ node.
