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

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

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

In NodeRED it looks like:

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:

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 ...

With a change node you can use jsonata:

2 Likes

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