# How to get value out of msg.payload

**URL:** <https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493>\
**Category:** General\
**Created:** [2 March 2020 11:35 UTC](https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493 "2020-03-02T11:35:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gbond](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gbond/32/38851_2.png) [@gbond](https://discourse.nodered.org/u/gbond)\
**Post date:** [2 March 2020 11:35 UTC](https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493/1 "2020-03-02T11:35:13Z")

</div>

object  
deviceId: "db1241be-ca6c-46d1-9606-9067fbc128ba"  
deviceType: "switch"  
name: "lounge colour2"  
value: 0

this is what I get from my msg.payload can anyone tell me how I can test what the "Value:" is  
I guess i can use the switch node but I can't see how to pick up on the Value (or for that matter any of the other info"

I hope this make sense

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [2 March 2020 11:42 UTC](https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493/2 "2020-03-02T11:42:01Z")

</div>

You were on the right track. Simply use the `switch` node and access the payload properties according to your data.

`msg.payload.value`, `msg.payload.name`, ....

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/392e97be70d11f212a1750145970e86788aa7449.png)

Note that object properties are case-sensitive, so `value` and `Value` would be different.

---

<div class="post-metadata">

**Author:** ![gbond](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gbond/32/38851_2.png) [@gbond](https://discourse.nodered.org/u/gbond)\
**Post date:** [2 March 2020 11:46 UTC](https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493/3 "2020-03-02T11:46:54Z")

</div>

off coarse thank you so much I though it should be simple

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [2 March 2020 11:57 UTC](https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493/4 "2020-03-02T11:57:06Z")

</div>

I see you've solved your issue, but take a look at [the working with messages part of the documentation](https://nodered.org/docs/user-guide/messages) too. It's always a good idea to get familiar with it 🙂

---

<div class="post-metadata">

**Author:** ![gbond](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gbond/32/38851_2.png) [@gbond](https://discourse.nodered.org/u/gbond)\
**Post date:** [2 March 2020 12:11 UTC](https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493/5 "2020-03-02T12:11:45Z")

</div>

very helpfull 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:** [1 May 2020 12:11 UTC](https://discourse.nodered.org/t/how-to-get-value-out-of-msg-payload/22493/6 "2020-05-01T12:11:48Z")

</div>

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