# How can I extract a value from message payload (object)? with the change node

**URL:** <https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996>\
**Category:** Dashboard\
**Created:** [10 December 2021 10:47 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996 "2021-12-10T10:47:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![WBr](https://avatars.discourse-cdn.com/v4/letter/w/b3f665/32.png) [@WBr](https://discourse.nodered.org/u/WBr)\
**Post date:** [10 December 2021 10:47 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/1 "2021-12-10T10:47:44Z")

</div>

Could someone explain me how I can extract a value (IP adress) so i only get the IP adress without other text?

I would like to have the text in green removed:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/0/300c101e57817ea321f48689b950fe0f4c0283e2.png)

But can't seem to figure out how. This is for UI purpose  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e770fcd3fc01c7644c60b602f413784823210782.png)

> **[node-red-contrib-ip](https://flows.nodered.org/node/node-red-contrib-ip)**
>
> This node provides the IP address (internal & public) of the machine hosting the Node-red.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [10 December 2021 10:50 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/2 "2021-12-10T10:50:25Z")

</div>

Hi @WBr

Welcome to the forum.

This page in the docs gives an overview of how to work with message objects - using the Debug sidebar to identify the path to any message element: [Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)

It'll be worth spending a bit of time reading through that.

To answer the immediate question, the Debug sidebar shows us you have `msg.payload` as an Object with a property called `internalIPv4`.

You can access its value as `msg.payload.internalIPv4`

---

<div class="post-metadata">

**Author:** ![WBr](https://avatars.discourse-cdn.com/v4/letter/w/b3f665/32.png) [@WBr](https://discourse.nodered.org/u/WBr)\
**Post date:** [10 December 2021 10:54 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/3 "2021-12-10T10:54:24Z")

</div>

Thank you for your reply,

I saw that you were writing within a minute of my post... Great enthusiasm! I have seen your other replies concerning the change node and I saw the link you provided there too (which is the same) but somehow it doesn't make sense in my brain.

I did use this msg.payload.internalIPv4 (figured that out from one of your previous posts) but then what? 🤔

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [10 December 2021 10:58 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/4 "2021-12-10T10:58:28Z")

</div>

> [@WBr](#):
>
> I did use this msg.payload.internalIPv4 (figured that out from one of your previous posts) but then what?

At this point, you've only asked how to access it, which has been answered.

So the question is really, what do you want to do with that value? If you want to display it on a Dashboard using the ui\_text node, then you can configure the ui\_text node to use `msg.payload.internalIPv4` as the value it displays. Or you can use a Change node to move the value from `msg.payload.internalIPv4` to `msg.payload` and then tell the ui\_text node to use `msg.payload` instead.

---

<div class="post-metadata">

**Author:** ![WBr](https://avatars.discourse-cdn.com/v4/letter/w/b3f665/32.png) [@WBr](https://discourse.nodered.org/u/WBr)\
**Post date:** [10 December 2021 11:03 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/5 "2021-12-10T11:03:08Z")

</div>

> [@knolleary](#):
>
> Or you can use a Change node to move the value from `msg.payload.internalIPv4` to `msg.payload` and then tell the ui\_text node to use `msg.payload` instead.

This part! I would like to be able to extract all types of data from payloads (slowly because it confuses me at this moment haha) at this moment, it is indeed only the IP adress that I would like to pass on.

---

<div class="post-metadata">

**Author:** ![WBr](https://avatars.discourse-cdn.com/v4/letter/w/b3f665/32.png) [@WBr](https://discourse.nodered.org/u/WBr)\
**Post date:** [10 December 2021 11:04 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/6 "2021-12-10T11:04:10Z")

</div>

> [@knolleary](#):
>
> to move

THANK YOU haha did you do this on purpose?

---

<div class="post-metadata">

**Author:** ![WBr](https://avatars.discourse-cdn.com/v4/letter/w/b3f665/32.png) [@WBr](https://discourse.nodered.org/u/WBr)\
**Post date:** [10 December 2021 11:09 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/7 "2021-12-10T11:09:58Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c6e376d62c535bfb17302f797855859ee32425a8.png)

---

<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:** [24 December 2021 11:10 UTC](https://discourse.nodered.org/t/how-can-i-extract-a-value-from-message-payload-object-with-the-change-node/54996/8 "2021-12-24T11:10:50Z")

</div>

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