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

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:

But can't seem to figure out how. This is for UI purpose

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

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

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? :thinking:

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.

1 Like

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.

THANK YOU haha did you do this on purpose?



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