# How to define an array and call a specifc value

**URL:** <https://discourse.nodered.org/t/how-to-define-an-array-and-call-a-specifc-value/32862>\
**Category:** General\
**Created:** [14 September 2020 09:53 UTC](https://discourse.nodered.org/t/how-to-define-an-array-and-call-a-specifc-value/32862 "2020-09-14T09:53:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [14 September 2020 09:53 UTC](https://discourse.nodered.org/t/how-to-define-an-array-and-call-a-specifc-value/32862/1 "2020-09-14T09:53:00Z")

</div>

Hi guys,

This maybe very straight forward but I`m struggling to format a data array read through a modbus server.

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

I want to refer to msg.payload[0] of the array but in doing so I get a response saying the point is undefined which causes further issues. Anyone aware of how I could refer to the first instance in the array properly?

---

<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:** [14 September 2020 10:31 UTC](https://discourse.nodered.org/t/how-to-define-an-array-and-call-a-specifc-value/32862/2 "2020-09-14T10:31:23Z")

</div>

Note that payload is an object containing the properties data, which is an array, and buffer, which is a buffer. So what you want is `msg.payload.data[0]`.  
Please read the node red docs page Working with Messages which you will find very helpful I am sure. In particular it shows you how to copy the path to a value from the debug output to get the address within the message.

---

<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:** [13 November 2020 10:31 UTC](https://discourse.nodered.org/t/how-to-define-an-array-and-call-a-specifc-value/32862/3 "2020-11-13T10:31:25Z")

</div>

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