# How does one create a new array from an existing array without Javascript node?

**URL:** <https://discourse.nodered.org/t/how-does-one-create-a-new-array-from-an-existing-array-without-javascript-node/33808>\
**Category:** General\
**Created:** [6 October 2020 04:20 UTC](https://discourse.nodered.org/t/how-does-one-create-a-new-array-from-an-existing-array-without-javascript-node/33808 "2020-10-06T04:20:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arretx](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arretx/32/10486_2.png) [@arretx](https://discourse.nodered.org/u/arretx)\
**Post date:** [6 October 2020 04:20 UTC](https://discourse.nodered.org/t/how-does-one-create-a-new-array-from-an-existing-array-without-javascript-node/33808/1 "2020-10-06T04:20:36Z")

</div>

I'm using the Gsheet node to pull a range of cells into a msg.payload. That payload ends up looking like this:

```auto
{
  "_msgid": "81847fa7.87fae",
  "payload": [
    [
      "John",
      "Doe",
      "18005551212",
      "email@whatever.com"
    ],
    [
      "Jane",
      "Doe",
      "18005551313",
      "email2@whatever.com"
    ]
  ],
  "topic": ""
}

```

In NodeRED it looks like:

```auto
payload: array[2]
  0: array[4]
    0: "John"
    1: "Doe"
    2: "18005551212"
    3: "email@whatever.com"
  1: array[4]
    0: "Jane Doe"
    1: "Doe"
    2: "18005551313"
    3: "email2@whatever.com"

```

My goal is to create a new array that looks like this:

```auto
payload: array[2]
  0: "18005551212"
  1: "18005551313"

```

So, I need to pull the value of `msg.payload[i][3]` out of this msg and join it into a new array.

I've managed to split the original message, but ...

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [6 October 2020 05:59 UTC](https://discourse.nodered.org/t/how-does-one-create-a-new-array-from-an-existing-array-without-javascript-node/33808/2 "2020-10-06T05:59:23Z")

</div>

With a change node you can use jsonata:

 ![Screenshot 2020-10-06 at 07.57.42](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfc15315b8747920383de36bbe4048ed4904be3a.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 December 2020 05:59 UTC](https://discourse.nodered.org/t/how-does-one-create-a-new-array-from-an-existing-array-without-javascript-node/33808/3 "2020-12-05T05:59:35Z")

</div>

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