# Set payload to part of MQTT Message not working

**URL:** <https://discourse.nodered.org/t/set-payload-to-part-of-mqtt-message-not-working/63210>\
**Category:** General\
**Created:** [29 May 2022 11:59 UTC](https://discourse.nodered.org/t/set-payload-to-part-of-mqtt-message-not-working/63210 "2022-05-29T11:59:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)\
**Post date:** [29 May 2022 11:59 UTC](https://discourse.nodered.org/t/set-payload-to-part-of-mqtt-message-not-working/63210/1 "2022-05-29T11:59:02Z")

</div>

Hi,

I want to get the **state** payload of an MQTT message  
But if I set msg.payload.state of this message to msg.payload with a change node, the payload is not returned to the debug node.

Why is that?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/67f8bb96539acb47748c992b55c7d85458d23bb3.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:** [29 May 2022 12:02 UTC](https://discourse.nodered.org/t/set-payload-to-part-of-mqtt-message-not-working/63210/2 "2022-05-29T12:02:23Z")

</div>

You lose the rest of msg.payload because you have over written msg.payload with that one value

Also you have the debug node set to not display. Click the button on the debug node

---

<div class="post-metadata">

**Author:** ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)\
**Post date:** [29 May 2022 12:07 UTC](https://discourse.nodered.org/t/set-payload-to-part-of-mqtt-message-not-working/63210/3 "2022-05-29T12:07:25Z")

</div>

Sorry....I feel so stupid....I have now used Move msg.payload.state to msg.payload AND turned on the debug node....and its working now...thanks!

---

<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:** [29 May 2022 12:46 UTC](https://discourse.nodered.org/t/set-payload-to-part-of-mqtt-message-not-working/63210/4 "2022-05-29T12:46:29Z")

</div>

If I had a nickel for every dumb thing I’ve done I’d be a millionaire 🤪

---

<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 June 2022 12:46 UTC](https://discourse.nodered.org/t/set-payload-to-part-of-mqtt-message-not-working/63210/5 "2022-06-12T12:46:56Z")

</div>

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