# Get only the payload value out of an array

**URL:** <https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308>\
**Category:** General\
**Created:** [23 February 2019 20:13 UTC](https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308 "2019-02-23T20:13:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cliffpza](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@cliffpza](https://discourse.nodered.org/u/cliffpza)\
**Post date:** [23 February 2019 20:13 UTC](https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308/1 "2019-02-23T20:13:51Z")

</div>

Hi there please help:

i have a select from mysql database that returns as follows:

![nodered-arrayresponse1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3d2e616dd9303e180e6f3d5b8b0b6328e4e61301.jpeg)

i need to POST to a webcollector and i need to isolate only the datainject string

i want to use the flow below but i need to know what to put in the function node for this to work please

![nodered-arrayresponse2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/89a540aa383b7648edffbc963ba07370fcbb476b.jpeg)

---

<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:** [24 February 2019 06:11 UTC](https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308/2 "2019-02-24T06:11:19Z")

</div>

Not sure what you are asking, but do you mean you need to convert the `datainject` string to json ?  
If so, attach a json node, which will parse it to an object.

---

<div class="post-metadata">

**Author:** ![cliffpza](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@cliffpza](https://discourse.nodered.org/u/cliffpza)\
**Post date:** [24 February 2019 07:24 UTC](https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308/3 "2019-02-24T07:24:44Z")

</div>

Thank you for replying, i want to send only the value in my datainject object to the API connector.

at the moment this value is in an the datainject object in the array

could you give me the node type and the commands to achieve this - i put a change node in my flow but not sure how to use it in this case

---

<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:** [24 February 2019 07:31 UTC](https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308/4 "2019-02-24T07:31:37Z")

</div>

The working with messages page in the documentation explains how to use the dining to get the right path to the string and you can then use that change node to move the string to being msg.payload

---

<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:** [24 February 2019 08:55 UTC](https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308/5 "2019-02-24T08:55:43Z")

</div>

> [@cliffpza](#):
>
> i want to send only the value in my datainject object

Do you mean you want to get the whole datainject string (which is the value _of_ the datainject object) or do you mean you want to get the contents of the `value` field in that string? That is 5560 in the example you posted.  
If the former then you just need to use a Change node to move the string into the payload (see the link provided earlier to see how to do that). If the latter then you can first move the string into the payload using a Change node, then feed it through a Json node, which will convert the string to a javascript object, then use another Change node to move the `value` field into the payload.

---

<div class="post-metadata">

**Author:** ![cliffpza](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@cliffpza](https://discourse.nodered.org/u/cliffpza)\
**Post date:** [24 February 2019 12:36 UTC](https://discourse.nodered.org/t/get-only-the-payload-value-out-of-an-array/8308/6 "2019-02-24T12:36:43Z")

</div>

Thank you for your advice gentlemen

i wanted the whole string and my solution was to use a change node as follows:

 ![nodered-arrayresponse4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/ee1bff5aa32fde69cb76544f79c216a8996a1a66.jpeg)
