Easy function question


I am using a get method on a http request node to get a temperature value from my heating.
It ends up in a function:
msg.payload = [{temp: msg.payload.eta.value[0].$.strValue},{room: "aussen"}]
return msg
unfortunately, the value in my array is like this:
temp: "7.5" (Degrees)
and not as it should be
temp: 7.5

So how can I remove these quotation marks?


Surround the assignment value with parseInt()

msg.payload = [{temp: parseInt(msg.payload.eta.value[0].$.strValue)},{room: "aussen"}]


Hi, in order to make code more readable and importable it is important to surround your code with three backticks
like this

You can edit and correct your post by clicking the pencil icon.

See this post for more details - How to share code or flow json

thanks, it works

It has been pointed out to me I should have said parseFloat not parseInt

I mislead you. I'm tired :wink: lol

Oh, what Happens If i do parsint?

parseInt will turn "7.5" into 7
parseFloat will turn "7.5" into 7.5

Ah, of course! I was just wondering... :stuck_out_tongue:

Hey Steve,

I still have the problem, that e.g. 10.8 transforms into 10.
I do it like this now:

msg.payload = [{temp: parseFloat(msg.payload.eta.value[0].$.strValue)},{room: "aussen"}]
return msg

debugging result looks like this:

10,8 is not 10.8

you will need to replace "," with "."


parseFloat(msg.payload.eta.value[0].$.strValue.replace(',','.').replace(' ',''))

that's it. thx

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