# Get number from output mysql

**URL:** <https://discourse.nodered.org/t/get-number-from-output-mysql/24212>\
**Category:** General\
**Created:** [4 April 2020 11:09 UTC](https://discourse.nodered.org/t/get-number-from-output-mysql/24212 "2020-04-04T11:09:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![warnert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/warnert/32/108132_2.png) [@warnert](https://discourse.nodered.org/u/warnert)\
**Post date:** [4 April 2020 11:09 UTC](https://discourse.nodered.org/t/get-number-from-output-mysql/24212/1 "2020-04-04T11:09:37Z")

</div>

I am creating the clock part for my roomthermostat. I have a database with times and temp's.  
I have a flow where a mysql query gives back one row with the temp that should be sent to the thermostat at a certain time. This comes out of the mysql block:

```auto
array[1]
0: object
tk_temp: "19.8"

```

I fed that through a json node as proposed in an other thread but then I have this:

```auto
"[{"tk_temp":"19.8"}]"

```

How do I get the 19.8 out there so I can feed that value in a mqtt-out that sets my roomthermostat (I know how to do that).  
Java is not my strongest point... 😊  
-Warner-

---

<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:** [4 April 2020 11:48 UTC](https://discourse.nodered.org/t/get-number-from-output-mysql/24212/2 "2020-04-04T11:48:13Z")

</div>

Hi.

You have fed an object into JSON node and it has turned it into a string.

Delete that and simply access the properties of the array mysql returns.

Read the documentation on [working with messages](https://nodered.org/docs/user-guide/messages), it shows you how to inspect objects in the debug window (even tells you if the payload is a string or object etc). Better still, it tells you how to select an item of interest and copy it's path.

I promise if you absorb that info, you won't find yourself asking questions like this.

> [@warnert](#):
>
> Java is not my strongest point

Nor mine. Luckily this is JavaScript (huge difference 🙂 )

---

<div class="post-metadata">

**Author:** ![warnert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/warnert/32/108132_2.png) [@warnert](https://discourse.nodered.org/u/warnert)\
**Post date:** [5 April 2020 11:48 UTC](https://discourse.nodered.org/t/get-number-from-output-mysql/24212/3 "2020-04-05T11:48:11Z")

</div>

I found the solution.  
With a Change node: set msg.payload to msg.payload[0].tk\_temp  
Now for the next challenge... (graphs...)

---

<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:** [19 April 2020 11:48 UTC](https://discourse.nodered.org/t/get-number-from-output-mysql/24212/4 "2020-04-19T11:48:20Z")

</div>

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