# Problem with undefined payload.object

**URL:** https://discourse.nodered.org/t/problem-with-undefined-payload-object/37151
**Category:** General
**Created:** [7 December 2020 21:01 UTC](https://discourse.nodered.org/t/problem-with-undefined-payload-object/37151 "2020-12-07T21:01:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![m.zendedel75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/m.zendedel75/32/32466_2.png) [@m.zendedel75](https://discourse.nodered.org/u/m.zendedel75)
#### Post date: [7 December 2020 21:01 UTC](https://discourse.nodered.org/t/problem-with-undefined-payload-object/37151/1 "2020-12-07T21:01:15Z")

</div>

Hi. at this code in node red, function in example 1 is good result, but in example 2 with mqtt transfer, it is show undefined result.

please guide.

```auto
[{"id":"4d0131.4da19ed","type":"inject","z":"ee4e8046.bf62c","name":"health","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"body_temprature\":37.5,\"heartbeat\":82}","payloadType":"json","x":150,"y":360,"wires":[["9593b787.e61a28"]]},{"id":"af830ac4.6d6e38","type":"function","z":"ee4e8046.bf62c","name":"","func":"var newMsg = { payload: msg.payload.heartbeat };\n\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":440,"wires":[["32c18820.84d5b8"]]},{"id":"32c18820.84d5b8","type":"debug","z":"ee4e8046.bf62c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":440,"wires":[]},{"id":"9593b787.e61a28","type":"mqtt out","z":"ee4e8046.bf62c","name":"","topic":"123","qos":"","retain":"","broker":"407a01e4.6b637","x":350,"y":360,"wires":[]},{"id":"9a7866c5.440b98","type":"mqtt in","z":"ee4e8046.bf62c","name":"","topic":"123","qos":"2","datatype":"auto","broker":"407a01e4.6b637","x":130,"y":440,"wires":[["af830ac4.6d6e38"]]},{"id":"fccfd442.274658","type":"aedes broker","z":"ee4e8046.bf62c","name":"broker","mqtt_port":"1884","mqtt_ws_port":"","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"x":510,"y":360,"wires":[[]]},{"id":"ec916e73.1e98c","type":"inject","z":"ee4e8046.bf62c","name":"health","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"body_temprature\":37.5,\"heartbeat\":82}","payloadType":"json","x":150,"y":120,"wires":[["f3f4769e.4ca9b8"]]},{"id":"f3f4769e.4ca9b8","type":"function","z":"ee4e8046.bf62c","name":"","func":"var newMsg = { payload: msg.payload.heartbeat };\n\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":120,"wires":[["a0cddb7f.b0ca58"]]},{"id":"a0cddb7f.b0ca58","type":"debug","z":"ee4e8046.bf62c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":120,"wires":[]},{"id":"407a01e4.6b637","type":"mqtt-broker","name":"","broker":"localhost","port":"1884","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

---

<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: [7 December 2020 21:20 UTC](https://discourse.nodered.org/t/problem-with-undefined-payload-object/37151/3 "2020-12-07T21:20:08Z")

</div>

(I fixed your flow)

In your MQTT-IN node, set the `output` to 'a parsed JSON object'

---

<div class="post-metadata">

### Author: ![m.zendedel75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/m.zendedel75/32/32466_2.png) [@m.zendedel75](https://discourse.nodered.org/u/m.zendedel75)
#### Post date: [8 December 2020 08:42 UTC](https://discourse.nodered.org/t/problem-with-undefined-payload-object/37151/4 "2020-12-08T08:42:36Z")

</div>

very very thanks [zenofmud] 🙏 🙏 🙏 🙏

---

<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: [22 December 2020 08:42 UTC](https://discourse.nodered.org/t/problem-with-undefined-payload-object/37151/5 "2020-12-22T08:42:53Z")

</div>

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