# Extract a value of an array

**URL:** <https://discourse.nodered.org/t/extract-a-value-of-an-array/10071>\
**Category:** General\
**Created:** [12 April 2019 15:55 UTC](https://discourse.nodered.org/t/extract-a-value-of-an-array/10071 "2019-04-12T15:55:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![smalhao](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@smalhao](https://discourse.nodered.org/u/smalhao)\
**Post date:** [12 April 2019 15:55 UTC](https://discourse.nodered.org/t/extract-a-value-of-an-array/10071/1 "2019-04-12T15:55:13Z")

</div>

I want to extract the value of a specific position in an array that I am receiving from Inject sent from a Raspberry Pi with the protocol OPC - UA as 'int' variable but I do not know how to do it in Node - RED

Node-RED message payload

```auto
12/04/2019, 16:47:43node: Pressure BMP180 Sensor
ns=2;i=4 : msg.payload : array[2]
array[2]
0: 0
1: 97448

12/04/2019, 16:12:22[node: Pressure BMP180 Sensor](http://10.6.4.101:1880/#)msg : string[15]

"Bad data inject"

```

The value i want is the 97454

My configuration in the Inject is:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5aa3dfb4a1269059edc75b99b7904f67d0e519b5.png)

I need the value of the 1: position in the array

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [12 April 2019 16:34 UTC](https://discourse.nodered.org/t/extract-a-value-of-an-array/10071/2 "2019-04-12T16:34:40Z")

</div>

The docs have a page called "Working with messages"

[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

That has instructions on how to get at specific data you can display with a debug node.  
Using that page and either a change node or a function node you should be able to do what you want to do.

---

<div class="post-metadata">

**Author:** ![smalhao](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@smalhao](https://discourse.nodered.org/u/smalhao)\
**Post date:** [23 April 2019 15:42 UTC](https://discourse.nodered.org/t/extract-a-value-of-an-array/10071/3 "2019-04-23T15:42:36Z")

</div>

The solution for my problem i think that way is correct, it's works for my situation and i share everyone

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/9dec02a735178fd834b1f23c6887dc12169d64a7.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/71b6dd26c4b640a8c08cec39b5293169f0f41cdc.png)

in the msg.payload.topic[1] the 1 is the position in array i want

if anyone has a suggestion to improve the programming I am open to suggestions

---

<div class="post-metadata">

**Author:** ![KirbyAnne](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@KirbyAnne](https://discourse.nodered.org/u/KirbyAnne)\
**Post date:** [4 April 2021 04:03 UTC](https://discourse.nodered.org/t/extract-a-value-of-an-array/10071/4 "2021-04-04T04:03:41Z")

</div>

Hello, I have the same problem, could you send me the configuration of each node please? My email is [antarita95@gmail.com](mailto:antarita95@gmail.com) please please help me

---

<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:** [4 April 2021 08:08 UTC](https://discourse.nodered.org/t/extract-a-value-of-an-array/10071/5 "2021-04-04T08:08:27Z")

</div>

Welcome to the forum. It is not clear exactly what problem you have. Please explain in more detail. Have you read the document linked earlier? Also if you are a newcomer to node-red I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.
