# Msg array to individual objects

**URL:** <https://discourse.nodered.org/t/msg-array-to-individual-objects/72048>\
**Category:** General\
**Created:** [11 December 2022 20:36 UTC](https://discourse.nodered.org/t/msg-array-to-individual-objects/72048 "2022-12-11T20:36:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [11 December 2022 20:36 UTC](https://discourse.nodered.org/t/msg-array-to-individual-objects/72048/1 "2022-12-11T20:36:02Z")

</div>

I have the following statement `if (obj.profit.percent < close) { msgSell.payload.push(obj.id)}` sending array to function output "msgSell" which currently looks like this:

![Screenshot 2022-12-08 201206](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/d/5da5344ed938cf4c6d34945ce54853d12338a3a7.jpeg)

I need to transform that into individual msg objects that must look like this:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a9fe0db2f9c1b4c9f3a6c7ee219ebb50feeadf01.png)

which are received with `let trade_id = msg.payload.id`

Stuck on this for several days. Even when I manage to transform it to something that looks right, I can't catch the variables. Thanks!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [11 December 2022 20:44 UTC](https://discourse.nodered.org/t/msg-array-to-individual-objects/72048/2 "2022-12-11T20:44:24Z")

</div>

Pass the array in payload through a split node then through a change node which sets the payload to the jsonata value `{"id": payload}`

---

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [11 December 2022 20:59 UTC](https://discourse.nodered.org/t/msg-array-to-individual-objects/72048/3 "2022-12-11T20:59:31Z")

</div>

Could you please share the flow of those two nodes?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 December 2022 22:11 UTC](https://discourse.nodered.org/t/msg-array-to-individual-objects/72048/4 "2022-12-11T22:11:03Z")

</div>

Which part do you not understand?

1. Pass the array in payload through a split node
2. then through a change node
3. which sets the payload to the jsonata value
4. {"id": payload}

---

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [11 December 2022 22:17 UTC](https://discourse.nodered.org/t/msg-array-to-individual-objects/72048/5 "2022-12-11T22:17:37Z")

</div>

Ok, I got it - thank you.

---

<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:** [10 February 2023 04:16 UTC](https://discourse.nodered.org/t/msg-array-to-individual-objects/72048/7 "2023-02-10T04:16:18Z")

</div>

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