# Cannot read property "Temperature" of undefined

**URL:** <https://discourse.nodered.org/t/cannot-read-property-temperature-of-undefined/56942>\
**Category:** General\
**Created:** [20 January 2022 00:23 UTC](https://discourse.nodered.org/t/cannot-read-property-temperature-of-undefined/56942 "2022-01-20T00:23:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)\
**Post date:** [20 January 2022 00:23 UTC](https://discourse.nodered.org/t/cannot-read-property-temperature-of-undefined/56942/1 "2022-01-20T00:23:33Z")

</div>

I'm sure others have asked similar here before, but can anyone spot the cause of this error in the debug bar (screenshot below)?

I have used the little "copy path" button to ensure I have the correct object path. I think it may be related to "AM2301" consisting of numbers. I have also tried using square bracket notation i.e. `msg.payload[AM2301].Temperature`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e0f995683a57adb3b35fd18bc054f5c3360b12f2.png)

---

<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:** [20 January 2022 00:35 UTC](https://discourse.nodered.org/t/cannot-read-property-temperature-of-undefined/56942/2 "2022-01-20T00:35:36Z")

</div>

You destroy the payload object inside the 1st if

Use else if for the 2nd if

---

<div class="post-metadata">

**Author:** ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)\
**Post date:** [20 January 2022 00:39 UTC](https://discourse.nodered.org/t/cannot-read-property-temperature-of-undefined/56942/3 "2022-01-20T00:39:04Z")

</div>

Duh, that was obvious but I missed it 🙂 Thanks!

---

<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:** [3 February 2022 00:39 UTC](https://discourse.nodered.org/t/cannot-read-property-temperature-of-undefined/56942/4 "2022-02-03T00:39:08Z")

</div>

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