# MQTT JSON Data in json input

**URL:** <https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124>\
**Category:** General\
**Created:** [14 March 2020 23:34 UTC](https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124 "2020-03-14T23:34:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![icodesdeveloper](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/icodesdeveloper/32/18370_2.png) [@icodesdeveloper](https://discourse.nodered.org/u/icodesdeveloper)\
**Post date:** [14 March 2020 23:34 UTC](https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124/1 "2020-03-14T23:34:11Z")

</div>

Hello

I am new to Node-Red and am experiencing with it. Now i am trying to dim and switch hue lights over the MQTT protocol with hassio. My app sends the following data to MQTT/Node-Red {"mqtt\_dashboard":{"color":"#8E8E8E","brightness":36}}

Now i have it setup to convert this to a real JSON item in Node-Red and that works. My question is how can i extract for example brightness and how can i use it as a "variable" in another element 'my light'

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [15 March 2020 06:10 UTC](https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124/2 "2020-03-15T06:10:49Z")

</div>

The [documentation](https://nodered.org/docs/user-guide/messages) might help (including the video)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 March 2020 09:07 UTC](https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124/3 "2020-03-15T09:07:21Z")

</div>

> [@icodesdeveloper](#):
>
> Now i have it setup to convert this to a real JSON item in Node-Red and that works

It is important in IT to get the terminology correct, otherwise people will get confused about what you mean. A JSON object is always a string, I imagine what you mean is that you have converted the JSON string that comes in from MQTT into a Javascript object. If you had to use a JSON node to do that then you might have been able instead to use the option in the MQTT node to parse the data as JSON and convert it to an object. That is the Output option Parsed JSON Object.

---

<div class="post-metadata">

**Author:** ![icodesdeveloper](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/icodesdeveloper/32/18370_2.png) [@icodesdeveloper](https://discourse.nodered.org/u/icodesdeveloper)\
**Post date:** [15 March 2020 13:02 UTC](https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124/4 "2020-03-15T13:02:38Z")

</div>

Yeah i know. But, when i am new to a programming language or programming related software it is always confusing. Btw thank you for your reaction it has been solved successfully.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 March 2020 13:31 UTC](https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124/5 "2020-03-15T13:31:09Z")

</div>

No criticism was intended, just clarifying the terminology.

---

<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:** [29 March 2020 13:31 UTC](https://discourse.nodered.org/t/mqtt-json-data-in-json-input/23124/6 "2020-03-29T13:31:10Z")

</div>

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