# Extract value (number) from node red payload?

**URL:** <https://discourse.nodered.org/t/extract-value-number-from-node-red-payload/31627>\
**Category:** General\
**Created:** [16 August 2020 21:38 UTC](https://discourse.nodered.org/t/extract-value-number-from-node-red-payload/31627 "2020-08-16T21:38:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![icanic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/icanic/32/27293_2.png) [@icanic](https://discourse.nodered.org/u/icanic)\
**Post date:** [16 August 2020 21:38 UTC](https://discourse.nodered.org/t/extract-value-number-from-node-red-payload/31627/1 "2020-08-16T21:38:52Z")

</div>

Greetings!  
I have problems with my Shelly dimmer 2. I have set it up over mqtt. Everything works great except dimming slider value. Dimming slider works great when I am using it, but I wan't that slider pick up the value from shelly dimmer when it is dimmed somewhere else.  
I have subscribed to MQTT topic "shellies/shellydimmer2-D8BFC01A040E/light/0/status" and when I dimm it somewhere else I get this on debug node

shellies/shellydimmer2-D8BFC01A040E/light/0/status : msg : Object

object

topic: "shellies/shellydimmer2-D8BFC01A040E/light/0/status"

payload: "{"ison":true,"has\_timer":false,"timer\_started":0,"timer\_duration":0,"timer\_remaining":0,"mode":"white", **"brightness":16** }"

qos: 0

retain: false

\_msgid: "14b5cdb.c291e32"

I would like to get only the value **"brightness":16** or any other value of brightness to output as number so I can send that number to slider node.

Can someone help me?

Thank you!

---

<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:** [16 August 2020 22:11 UTC](https://discourse.nodered.org/t/extract-value-number-from-node-red-payload/31627/2 "2020-08-16T22:11:12Z")

</div>

Hello & welcome to the fourm.

> [@icanic](#):
>
> payload: "{"ison":true,"has\_timer":false,"timer\_started":0,"timer\_duration":0,"timer\_remaining":0,"mode":"white", **"brightness":16** }"

So a small lesson on JS objects and their equivalent string representation (AKA JSON)...

_Your `payload` is a string/JSON (due to the `Output` setting on the MQTT node). You could attempt some complex splits and loops etc - but - as it is JSON (JavaScript Object Notation) - just let JS do its thing - turn that JSON back into a JS Object! (if you dont know what I mean, it'd be worth reading up - will help you greatly in node-red knowing the difference)_

So first off, change your MQTT IN to...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/96825f9eb1741931963016f09832e3b7772c069c.png)  
... then you will be able to simply "copy path" to any item

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

---

<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:** [15 October 2020 22:11 UTC](https://discourse.nodered.org/t/extract-value-number-from-node-red-payload/31627/3 "2020-10-15T22:11:13Z")

</div>

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