# Msg conversion issues

**URL:** <https://discourse.nodered.org/t/msg-conversion-issues/37544>\
**Category:** General\
**Created:** [15 December 2020 20:01 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544 "2020-12-15T20:01:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [15 December 2020 20:01 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544/1 "2020-12-15T20:01:04Z")

</div>

Good evening

I have a function node that manipulates text and outputs in the following variables.

var out = {payload: [i] + StrIO[i] + Temp[i] };  
node.send({payload:out});

I am trying to feed this value into a change node but I have noticed using a debug node that it shows it as payload object not payload string which means the change node does not work.  
If I feed my value into the change node using an inject node it works.

So I guess I need to convert the msg object value to a string

Many thanks In anticipation

regards  
Andrew

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [15 December 2020 20:17 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544/2 "2020-12-15T20:17:05Z")

</div>

You’ve stacked your payload inside another payload. Maybe just return out ?

---

<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 December 2020 20:17 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544/3 "2020-12-15T20:17:51Z")

</div>

As `i` is a number it will try to do arithmetic addition instead of string. Convert `i` to a string before concatenating them. Or even better use string interpolation.

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [15 December 2020 22:11 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544/4 "2020-12-15T22:11:35Z")

</div>

Dceejay  
Many thanks for your reply unfortunately I do not understand your response, please accept my ignorance on this matter

---

<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:** [16 December 2020 07:26 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544/5 "2020-12-16T07:26:24Z")

</div>

You have created an object called `out` that contains a property called `payload`. Then in the `node.send()` call you create another object containing a property called `payload` which itself contains the `out` object.  
The result is that when you receive that message in the next node `msg.payload` contains your `out` object.  
Possibly what you meant was  
`node.send(out)`

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [16 December 2020 07:39 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544/6 "2020-12-16T07:39:26Z")

</div>

Hi Colin

Many thanks for helping me out, I really struggle with the msg part of node red and have tried reading the documents on it maybe I am to old lol.

Again thank you it worked like a dream and thank you to the forum.

Regards

Andrew

---

<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:** [14 February 2021 07:39 UTC](https://discourse.nodered.org/t/msg-conversion-issues/37544/7 "2021-02-14T07:39:34Z")

</div>

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