# Help with message structure and sharing it. (making it visible)

**URL:** <https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982>\
**Category:** General\
**Created:** [13 March 2025 21:25 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982 "2025-03-13T21:25:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [13 March 2025 21:25 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/1 "2025-03-13T21:25:31Z")

</div>

Folks, this has got me going around in circles.

I have OLD (Noah vintage) code and it is (of course) buggy.

I've put in new code to help parse the error and give me more information, but.....

It isn't working.

This is what I'm getting `Oops message [object Object]`  
Which doesn't help.

This is the node which makes the message:

```auto
if (msg.payload == "On-line") {
    msg.payload = ({ fill: "green", text: "Online" });
} else
if (msg.payload == "Off-lineB")
{
    msg.payload = ({ fill: "yellow", text: "Offline" });
} else
if (msg.payload == "Off-lineC")
{
    msg.payload = ({ fill: "red", text: "Offline" });
} else
if (msg.payload == "Off-line") {
    msg.payload = ({ fill: "yellow", text: "Offline" });
} else
{
    msg.payload = ({fill: "blue", text: "oops"});
    node.warn("Oops message " + msg.payload);
}
return msg;

```

Note the `node.warn` line.

So - looking at it - the _message_ is an object. Fair enough.

But I'd like to see that object so I can better understand what is going on.

This is only the first step as I have another `subflow` further down the line which is saying it is getting errors when it isn't and I am going to have to put in serious work to get my head around it.  
I digress.

Sorry.

So what do I need to do to _expand_ the objects so I can better see what's going on?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 March 2025 21:34 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/2 "2025-03-13T21:34:28Z")

</div>

Change it to...

```auto
node.warn({info: "Oops message", payload: msg.payload});

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [13 March 2025 21:35 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/3 "2025-03-13T21:35:52Z")

</div>

Thanks.

I'll mention here, that that node is in a ..... (cringe) `subflow` too... ☹  
I know not many people like that.

But shall do now.

Thanks.

That did work.

Alas still no progress on the bigger picture though.

---

<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:** [14 March 2025 06:51 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/4 "2025-03-14T06:51:18Z")

</div>

> [@Trying\_to\_learn](#):
>
> ```auto
> msg.payload = ({ fill: "green", text: "Online" }); 
> 
> ```

Once you are using `( ... )` you are calling a function, remove them.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 March 2025 07:13 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/5 "2025-03-14T07:13:23Z")

</div>

> [@Steve-Mcl](#):
>
> `node.warn({info: "Oops message", payload: msg.payload});`

Thanks.

But I think it needs to be like that but with quotes in it something like:

`msg.payload - ('{fill:"green", text:" Online" }')`  
as the `fill:"green", text:"Online"}` is to be used for the node.status bit further down the chain.

---

<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:** [14 March 2025 07:26 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/6 "2025-03-14T07:26:53Z")

</div>

First you set an object:

```auto
msg.payload = { fill: "green", text: "Online" }

```

if you want to use that later:

```auto
node.status(msg.payload)

// if you want 'oops':
node.warn('Oops: ' + JSON.stringify(msg.payload)) 
// or as an object:
node.warn(msg.payload)

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 March 2025 07:34 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/7 "2025-03-14T07:34:20Z")

</div>

Thanks and sorry.

Been a bad day. Train network fell over and I lost a lot of time on other things.

Had to quit this morning and have kind of only just got back to it.

---

<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:** [28 March 2025 07:34 UTC](https://discourse.nodered.org/t/help-with-message-structure-and-sharing-it-making-it-visible/95982/8 "2025-03-28T07:34:32Z")

</div>

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