# Message payload as float-array?

**URL:** <https://discourse.nodered.org/t/message-payload-as-float-array/5291>\
**Category:** General\
**Created:** [29 November 2018 09:20 UTC](https://discourse.nodered.org/t/message-payload-as-float-array/5291 "2018-11-29T09:20:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abra](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/abra/32/3443_2.png) [@abra](https://discourse.nodered.org/u/abra)\
**Post date:** [29 November 2018 09:20 UTC](https://discourse.nodered.org/t/message-payload-as-float-array/5291/1 "2018-11-29T09:20:20Z")

</div>

Is it possible to define the payload of a message as a float-array ? I need that to publish some MQTT data where the MQTT payload has to be a float-array.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [29 November 2018 09:26 UTC](https://discourse.nodered.org/t/message-payload-as-float-array/5291/2 "2018-11-29T09:26:30Z")

</div>

Hi @abra

the payload of an MQTT message is raw bytes - so you have to decide how you want to encode your data.

If you pass an array to the the MQTT Out node, it will JSON encode it to a string representation of the data.

So if `msg.payload` is the array `[1.5, 2.7, 3.0]`, it will be stringified as JSON: `[1.5, 2.7, 3]`

The stringifing to JSON will cause floats like `3.0` to be represented as `3` - that can cause problems for some receiving libraries that cannot handle `3` as a float. If that is the case, you'd have to create your own string representation of the array that preserved the `3.0` in the text.
