# Why am I not getting this? msg.(stuff)

**URL:** https://discourse.nodered.org/t/why-am-i-not-getting-this-msg-stuff/1954
**Category:** General
**Created:** [1 August 2018 00:27 UTC](https://discourse.nodered.org/t/why-am-i-not-getting-this-msg-stuff/1954 "2018-08-01T00:27:06Z")
**Posts on this page:** 5
**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: [1 August 2018 00:27 UTC](https://discourse.nodered.org/t/why-am-i-not-getting-this-msg-stuff/1954/1 "2018-08-01T00:27:06Z")

</div>

I have a function node.

It has this in it.

```auto
var msg2 = { payload:"", background:"red"};
return [msg,msg2];

```

the second output goes to a button and it sets the colour. (Derived from msg.background)

I am messing about with an INJECT node: (JSON)

```auto
{"payload":"","background":"lime"}

```

Doesn't work.  
Looking, the message has an OBJECT which than has a sub-part background.

Ok.... Not too much of a worry. I'll write it in another function node and be done with it.

```auto
payload="",background="red";
return msg;

```

Pretty well the first one, but only with one output.

Also doesn't work.

Anyone know where I can buy a new brain? This one seems to not be working.

I **AM** sorry. I do NOT like being like I am, but I am stuck with it.

I don't get WHY I am not getting this "syntax" stuff for how messages are "structured".  
What is it that I am missing?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [1 August 2018 01:16 UTC](https://discourse.nodered.org/t/why-am-i-not-getting-this-msg-stuff/1954/3 "2018-08-01T01:16:50Z")

</div>

> [@Trying\_to\_learn](#):
>
> I am messing about with an INJECT node: (JSON)
> 
> ```auto
> {"payload":"","background":"lime"}
> 
> ```

go look at our inject node and ask your self "Where is the json being stored?'

adding some ebug nodes might help you figure out what is going wrong

---

<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: [1 August 2018 01:22 UTC](https://discourse.nodered.org/t/why-am-i-not-getting-this-msg-stuff/1954/4 "2018-08-01T01:22:34Z")

</div>

This is the example I am using:

```auto
[{"id":"a42a2937.c49d1","type":"debug","z":"afeeae02.67742","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":580,"y":770,"wires":[]},{"id":"1cda3566.bbbb63","type":"inject","z":"afeeae02.67742","name":"","topic":"","payload":"{ \"payload\":\"\", \"background\":\"red\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":730,"wires":[["951ac643.5abde"]]},{"id":"b6f9f2fe.7849c8","type":"function","z":"afeeae02.67742","name":"","func":"msg.topic=\"ENABLE\";\nvar msg = { payload:\"\", background:\"lime\"};\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":770,"wires":[["a42a2937.c49d1"]]},{"id":"5ab558bd.ac87d","type":"inject","z":"afeeae02.67742","name":"","topic":"","payload":"Blah","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":770,"wires":[["b6f9f2fe.7849c8"]]},{"id":"951ac643.5abde","type":"debug","z":"afeeae02.67742","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":580,"y":730,"wires":[]}]

```

Not rocket science.

This is the screen shot - as a picture says 1000 words.  
The two outputs are not the same - to me anyway.

 ![Screenshot%20from%202018-08-01%2011-20-06](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/aab0b335e65da96ccd6426a7c3cbe15ff0e3ed59.png)

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [1 August 2018 02:05 UTC](https://discourse.nodered.org/t/why-am-i-not-getting-this-msg-stuff/1954/5 "2018-08-01T02:05:15Z")

</div>

> [@Trying\_to\_learn](#):
>
> This is the screen shot - as a picture says 1000 words.  
> The two outputs are not the same - to me anyway.

You are correct. Now go back and look at the inject node and read it’s info tab and look at the settings and see if you can determine why the debug node connected to the inject node displays what it does.

---

<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: [1 August 2018 02:08 UTC](https://discourse.nodered.org/t/why-am-i-not-getting-this-msg-stuff/1954/6 "2018-08-01T02:08:54Z")

</div>

Because it can only deal with msg.payload and msg.topic - right?

I got caught up with msg.background and forgot (yeah, pitiful) that it only does payload and topic.

Right?

Just when I am trying to pick a problem to pieces, I just "grab" the inject and stick things in it forgetting the limits.

I either need the change node or the function node to do the extra bits.
