# MQTT is driving me crazy. How to format messages - again, sorry

**URL:** https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858
**Category:** General
**Created:** [29 December 2022 01:33 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858 "2022-12-29T01:33:40Z")
**Posts on this page:** 17
**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: [29 December 2022 01:33 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/1 "2022-12-29T01:33:40Z")

</div>

(This is not enjoyable for me as it clearly shows how bad I am at remembering things.)

Cutting to it:  
I want to send a _complex_ message over MQTT.  
I want to send the `payload` and `state`.  
The actual message is HUGE. ☹  
But despite my every effort I can NOT get what I want out of the remote MQTT node.

Basically I want this as the message (with given variables in the fields)

```auto
{"payload":{"payload":"2022-12-29 12:05:09 Main - Up","state":"Up"},"_msgid":"f1dab4a30fac58e1"}

```

As is I get this at the remote end:

```auto
{"payload":"2022-12-29 12:05:09 Main - Up","state":"Up"}

```

But it isn't _recognised_ and can't be put back to what I sent.  
If I put it through a `JSON` node I get the same out as I put it.  
I have spent 30 minutes trying permutations of nodes, JSON and `function` at ends and just can't get the desired result.  
It is always a `payload` with the message in it. (the `payload` and `state` messages.)

I won't waste your time explaining what I learnt a long time ago when I went through this the painful way.  
But I was told a couple of times and I WROTE IT DOWN - what to do and how to do it.  
Now it doesn't seem to be playing by the same rules.

Someone - please.

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [29 December 2022 02:03 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/2 "2022-12-29T02:03:04Z")

</div>

Do you need to include the msgid ?  
Also do you need a payload within another 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: [29 December 2022 02:08 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/3 "2022-12-29T02:08:55Z")

</div>

Hi Steve.

Maybe this will help.  
This is the whole thing - just to maybe help.  
(ok, not THE WHOLE THING, but a cut down part of what IS the code)

```auto
[{"id":"c611da12474cc64f","type":"inject","z":"9dc4f25c091456e7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":370,"wires":[["12e8f83cb0ca06a5"]]},{"id":"12e8f83cb0ca06a5","type":"function","z":"9dc4f25c091456e7","name":"function 8","func":"msg = \n { \"delay\": 120000, \"origPayload\": \"[\\\"Marys_Farm_2.4\\\", \\\"Marys_Farm_2.4\\\", \\\"Optus_ABA172_5GHz\\\", \\\"Marys_Farm_5\\\", \\\"Optus_ABA172\\\", \\\"TelstraCA5E31\\\", \\\"\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\", \\\"WiFi-AFB6\\\", \\\"PiNet\\\", \\\"MyRepublic 49D9\\\", \\\"WiFi-F852-5G\\\", \\\"WiFi-F852\\\", \\\"WiFi-AFB6-5G\\\"]\", \"settings\": { \"input\": \"2022-12-29T01:05:09.987Z\", \"input_format\": \"\", \"input_tz\": \"Australia/Sydney\", \"output_format\": \"YYYY-MM-DD HH:mm:ss\", \"output_locale\": \"en_AU\", \"output_tz\": \"Australia/Sydney\" }, \"time\": \"2022-12-29 12:05:09\", \"payload\": \"2022-12-29 12:05:09 Main - Up\", \"parts\": { \"id\": \"65a01a72889a1b8b\", \"type\": \"string\", \"ch\": \",\", \"index\": 1, \"count\": 13 }, \"_msgid\": \"78d70cd5afd842b2\", \"_event\": \"node:59d4324dd537c9e8\", \"state\": \"Up\", \"filename\": \"/media/pi/9020-9C27/events/main.db\", \"device\": \"Main\" }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":370,"wires":[["5ba78680e4db67c3","3ac66f31b7991a30","4d22b8e3dfa753bc","a0ad6fcbc14eefed"]]},{"id":"5ba78680e4db67c3","type":"debug","z":"9dc4f25c091456e7","name":"Payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":290,"wires":[]},{"id":"3ac66f31b7991a30","type":"debug","z":"9dc4f25c091456e7","name":"FULL","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":540,"y":250,"wires":[]},{"id":"4d22b8e3dfa753bc","type":"function","z":"9dc4f25c091456e7","name":"function 9","func":"let msg2 = {};\nmsg2.payload = {\"payload\":msg.payload,\"state\":msg.state};\nreturn msg2;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":440,"wires":[["cde947a1f2bb79a5","ad528e22a4e5ca79","f01425be1c6b6365"]]},{"id":"a0ad6fcbc14eefed","type":"debug","z":"9dc4f25c091456e7","name":"State","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"state","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":330,"wires":[]},{"id":"ad528e22a4e5ca79","type":"debug","z":"9dc4f25c091456e7","name":"My effort on what to send.","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":560,"y":490,"wires":[]},{"id":"f01425be1c6b6365","type":"mqtt out","z":"9dc4f25c091456e7","name":"","topic":"test","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"8941f4c3.0f151","x":690,"y":370,"wires":[]},{"id":"cde947a1f2bb79a5","type":"json","z":"9dc4f25c091456e7","d":true,"name":"","property":"payload","action":"","pretty":false,"x":560,"y":440,"wires":[["f01425be1c6b6365","b375a3d80fe5b24f"]]},{"id":"8941f4c3.0f151","type":"mqtt-broker","name":"Local","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

I won't say much more as I feel I am actually making things worse for myself the more I say at this point.

Does this explain it better?

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [29 December 2022 02:11 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/4 "2022-12-29T02:11:19Z")

</div>

this should give you what you want I think ?

msg = { payload: "2022-12-29 12:05:09 Main - Up", state: "Up"}

---

<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: [29 December 2022 02:13 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/5 "2022-12-29T02:13:19Z")

</div>

Yes, but that excludes the variability of the two text parts.  
Those are _real_ values, but are also variable in:  
the date/time, the "Main - Up" and the state.  
So those parts need to be \*extracted from the incoming payload. The "BIG" one.  
(Debug node not active on the flow I posted)

And:  
Would that survive going through MQTT?  
Would I get both the `payload` and `state` at the other end?  
I thought MQTT only sent the `payload`.

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [29 December 2022 02:35 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/6 "2022-12-29T02:35:42Z")

</div>

OK I see what you mean - don't use payload then, so something like this -  
msg = { payld: msg.payload, "state": msg.state };

---

<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: [29 December 2022 02:39 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/7 "2022-12-29T02:39:33Z")

</div>

can you explain for the idiot in the class where `payld` comes? ( **SORRY EDITED** )

And ITMT I have nearly done exactly the same thing and got it working now.

But I would like to hear what you mean with `payld` please.

Excluding the `MQTT` nodes, this is what I did and it seems to work.  
I get the `payload` and `state ` at the remote end.

```auto
[{"id":"c611da12474cc64f","type":"inject","z":"9dc4f25c091456e7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":370,"wires":[["12e8f83cb0ca06a5"]]},{"id":"12e8f83cb0ca06a5","type":"function","z":"9dc4f25c091456e7","name":"function 8","func":"msg = \n { \"delay\": 120000, \"origPayload\": \"[\\\"Marys_Farm_2.4\\\", \\\"Marys_Farm_2.4\\\", \\\"Optus_ABA172_5GHz\\\", \\\"Marys_Farm_5\\\", \\\"Optus_ABA172\\\", \\\"TelstraCA5E31\\\", \\\"\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\", \\\"WiFi-AFB6\\\", \\\"PiNet\\\", \\\"MyRepublic 49D9\\\", \\\"WiFi-F852-5G\\\", \\\"WiFi-F852\\\", \\\"WiFi-AFB6-5G\\\"]\", \"settings\": { \"input\": \"2022-12-29T01:05:09.987Z\", \"input_format\": \"\", \"input_tz\": \"Australia/Sydney\", \"output_format\": \"YYYY-MM-DD HH:mm:ss\", \"output_locale\": \"en_AU\", \"output_tz\": \"Australia/Sydney\" }, \"time\": \"2022-12-29 12:05:09\", \"payload\": \"2022-12-29 12:05:09 Main - Up\", \"parts\": { \"id\": \"65a01a72889a1b8b\", \"type\": \"string\", \"ch\": \",\", \"index\": 1, \"count\": 13 }, \"_msgid\": \"78d70cd5afd842b2\", \"_event\": \"node:59d4324dd537c9e8\", \"state\": \"Up\", \"filename\": \"/media/pi/9020-9C27/events/main.db\", \"device\": \"Main\" }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":370,"wires":[["5ba78680e4db67c3","3ac66f31b7991a30","4d22b8e3dfa753bc","a0ad6fcbc14eefed"]]},{"id":"4d22b8e3dfa753bc","type":"function","z":"9dc4f25c091456e7","name":"function 9","func":"let msg2 = {};\nmsg2.payload = {\"payload\":msg.payload,\"state\":msg.state};\nreturn msg2;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":440,"wires":[["cde947a1f2bb79a5","ad528e22a4e5ca79","f01425be1c6b6365"]]},{"id":"e1d27bc5107c467e","type":"function","z":"9dc4f25c091456e7","name":"function 12","func":"let text = msg.payload;\nlet msg2 = {};\nmsg2 = msg.payload;\n\nnode.warn(msg2);\n\n//node.warn(text);\n\n//let position = text.search(\"Up\");\n\n//node.warn(position);\n\nreturn msg2;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":300,"wires":[["97e5c5e6f7b8313a"]]},{"id":"97e5c5e6f7b8313a","type":"debug","z":"9dc4f25c091456e7","name":"debug 55","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1100,"y":300,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [29 December 2022 02:59 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/9 "2022-12-29T02:59:24Z")

</div>

Disregard that I'm talking at crossed purposes.

msg.payload is required for MQTT node to work.

---

<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: [29 December 2022 03:00 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/10 "2022-12-29T03:00:26Z")

</div>

Yeah, ok.

Thanks.

But (I know: I'm taking this too literally) when I did what you said, it _crashed and burned_.

(No offense)

But it throws a spanner in the works for me.

Using your node as best I can understand.

 ![Screenshot from 2022-12-29 13-55-37](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/a/6ad052816049e6251f1fe78b70d6998e7421c952.png)

My node

 ![Screenshot from 2022-12-29 13-55-58](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dc8d9f7265624961b0b1ed3708bc1b2d52d174cf.png)

Code:

```auto
[{"id":"12e8f83cb0ca06a5","type":"function","z":"9dc4f25c091456e7","name":"function 8","func":"msg = \n { \"delay\": 120000, \"origPayload\": \"[\\\"Marys_Farm_2.4\\\", \\\"Marys_Farm_2.4\\\", \\\"Optus_ABA172_5GHz\\\", \\\"Marys_Farm_5\\\", \\\"Optus_ABA172\\\", \\\"TelstraCA5E31\\\", \\\"\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\", \\\"WiFi-AFB6\\\", \\\"PiNet\\\", \\\"MyRepublic 49D9\\\", \\\"WiFi-F852-5G\\\", \\\"WiFi-F852\\\", \\\"WiFi-AFB6-5G\\\"]\", \"settings\": { \"input\": \"2022-12-29T01:05:09.987Z\", \"input_format\": \"\", \"input_tz\": \"Australia/Sydney\", \"output_format\": \"YYYY-MM-DD HH:mm:ss\", \"output_locale\": \"en_AU\", \"output_tz\": \"Australia/Sydney\" }, \"time\": \"2022-12-29 12:05:09\", \"payload\": \"2022-12-29 12:05:09 Main - Up\", \"parts\": { \"id\": \"65a01a72889a1b8b\", \"type\": \"string\", \"ch\": \",\", \"index\": 1, \"count\": 13 }, \"_msgid\": \"78d70cd5afd842b2\", \"_event\": \"node:59d4324dd537c9e8\", \"state\": \"Up\", \"filename\": \"/media/pi/9020-9C27/events/main.db\", \"device\": \"Main\" }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":480,"wires":[["5ba78680e4db67c3","3ac66f31b7991a30","a0ad6fcbc14eefed","4d22b8e3dfa753bc"]]},{"id":"c611da12474cc64f","type":"inject","z":"9dc4f25c091456e7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":480,"wires":[["12e8f83cb0ca06a5"]]},{"id":"5ba78680e4db67c3","type":"debug","z":"9dc4f25c091456e7","name":"Payload","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":400,"wires":[]},{"id":"f01425be1c6b6365","type":"mqtt out","z":"9dc4f25c091456e7","name":"","topic":"test","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"8941f4c3.0f151","x":690,"y":480,"wires":[]},{"id":"f626d563d1d359cd","type":"mqtt in","z":"9dc4f25c091456e7","name":"","topic":"test","qos":"2","datatype":"auto-detect","broker":"8941f4c3.0f151","nl":false,"rap":true,"rh":0,"inputs":0,"x":840,"y":480,"wires":[["0bbde8f77929d592","e1d27bc5107c467e"]]},{"id":"97e5c5e6f7b8313a","type":"debug","z":"9dc4f25c091456e7","name":"debug 55","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1150,"y":480,"wires":[]},{"id":"3ac66f31b7991a30","type":"debug","z":"9dc4f25c091456e7","name":"FULL","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":540,"y":360,"wires":[]},{"id":"4d22b8e3dfa753bc","type":"function","z":"9dc4f25c091456e7","name":"My function node here","func":"let msg2 = {};\nmsg2.payload = {\"payload\":msg.payload,\"state\":msg.state};\nreturn msg2;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":560,"wires":[["ad528e22a4e5ca79","f01425be1c6b6365"]]},{"id":"0bbde8f77929d592","type":"debug","z":"9dc4f25c091456e7","name":"debug 56","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":430,"wires":[]},{"id":"ad528e22a4e5ca79","type":"debug","z":"9dc4f25c091456e7","name":"My effort on what to send.","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1000,"y":610,"wires":[]},{"id":"a0ad6fcbc14eefed","type":"debug","z":"9dc4f25c091456e7","name":"State","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"state","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":440,"wires":[]},{"id":"e1d27bc5107c467e","type":"function","z":"9dc4f25c091456e7","name":"function 12","func":"let text = msg.payload;\nlet msg2 = {};\nmsg2 = msg.payload;\n\nnode.warn(msg2);\n\n//node.warn(text);\n\n//let position = text.search(\"Up\");\n\n//node.warn(position);\n\nreturn msg2;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":480,"wires":[["97e5c5e6f7b8313a"]]},{"id":"42cc99af2bd04069","type":"function","z":"9dc4f25c091456e7","name":"Your function node here.","func":"msg = { \"payload\": msg.payload, \"state\": msg.state };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":610,"wires":[["f01425be1c6b6365","ad528e22a4e5ca79"]]},{"id":"8941f4c3.0f151","type":"mqtt-broker","name":"Local","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

Sorry, but what am I missing?

(But I do have it working now.)  
Though for the sake of learning, I now want to understand what your code is supposed to do.

---

<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: [29 December 2022 03:01 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/11 "2022-12-29T03:01:58Z")

</div>

Ah, that may explain what I just asked in the other post.

But please, if you don't mind.... Check.  
🙂

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [29 December 2022 03:02 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/12 "2022-12-29T03:02:01Z")

</div>

Just ignore me having a senior moment 😉

---

<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: [29 December 2022 03:02 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/13 "2022-12-29T03:02:37Z")

</div>

No problems.

I have them all the time.  
That is why I am asking the questino I am asking. :giggle:

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [29 December 2022 03:03 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/14 "2022-12-29T03:03:38Z")

</div>

Only excuse is its after 3am 😴

---

<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: [29 December 2022 03:04 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/15 "2022-12-29T03:04:55Z")

</div>

{{hugs}}

I miss the days when I was working ok at 03:00.

I'll leave you alone now.  
Look/check what I asked when you can.  
No rush. I think you answered it anyway, but just to be 100% sure.

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [29 December 2022 03:18 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/16 "2022-12-29T03:18:06Z")

</div>

So what I was trying to say was this -

msg.payload = {payload:msg.payload,state:msg.state};

and in this case the property "payload" (within the msg.payload object) can be called anything 😉

eg msg.payload = {wibble:msg.payload,state:msg.state};

Oh and this is Sean not Steve BTW 😉

---

<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: [29 December 2022 03:23 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/17 "2022-12-29T03:23:06Z")

</div>

Sorry. I am not good with names either.

---

<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: [12 January 2023 03:23 UTC](https://discourse.nodered.org/t/mqtt-is-driving-me-crazy-how-to-format-messages-again-sorry/72858/18 "2023-01-12T03:23:41Z")

</div>

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