# Convert array values to array of objects

**URL:** https://discourse.nodered.org/t/convert-array-values-to-array-of-objects/69652
**Category:** General
**Created:** [27 October 2022 03:37 UTC](https://discourse.nodered.org/t/convert-array-values-to-array-of-objects/69652 "2022-10-27T03:37:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![MrThiemann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrthiemann/32/68063_2.png) [@MrThiemann](https://discourse.nodered.org/u/MrThiemann)
#### Post date: [27 October 2022 03:37 UTC](https://discourse.nodered.org/t/convert-array-values-to-array-of-objects/69652/1 "2022-10-27T03:37:46Z")

</div>

Hey 👋,  
i want to change my payload[...][0] and payload[...][1]

0 == articlenumber  
1 == stock

I would like to attach an image here, but somehow the upload is not working right now

````auto
{"_msgid":"01cf032528f70f17","payload":[["4011231255158","500"],["4038898600503","1"],["4011231254991","1"],["4058794457551","1"],["4058794457551","3"],["4038898600508","1"],["123","2"]],"topic":""}```
````

---

<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: [27 October 2022 04:29 UTC](https://discourse.nodered.org/t/convert-array-values-to-array-of-objects/69652/2 "2022-10-27T04:29:53Z")

</div>

I am not entirely sure what your question is.

Small tip: if you are looking for data transformations, provide the input and the expected payload output (as node-red should produce it).

I assume you want your array to be converted to (?) :  
 ![SCR-20221027-8wc](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/a/9ad3532a00d562041a6205fcf19bb1f2db86af5b.png)

You can use a change node, set it to a jsonata expression:

```auto
payload.{
   "articlenumber": $[0],
   "stock": $[1] 
}

```

---

<div class="post-metadata">

### Author: ![MrThiemann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrthiemann/32/68063_2.png) [@MrThiemann](https://discourse.nodered.org/u/MrThiemann)
#### Post date: [27 October 2022 04:32 UTC](https://discourse.nodered.org/t/convert-array-values-to-array-of-objects/69652/3 "2022-10-27T04:32:53Z")

</div>

Just what I was looking for! thanks

---

<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 November 2022 04:33 UTC](https://discourse.nodered.org/t/convert-array-values-to-array-of-objects/69652/4 "2022-11-10T04:33:34Z")

</div>

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