Worldmap String Format

#1

I am using the worldmap node to create pins on a local map of our devices. I have it working fine manually however when one get the info from my locations it is not formatted correctly. Could somebody point me in the correct direction to get the {} around my payload to go into the worldmap?

If I use the inject / payload JSON and put {"name":"cvt", "label":"My Office","lat":36.69, "lon":-93.21} all is good! However when I get this info through my MQTT and back into my server it looks like this

""name":"cvt", "label":"My Office","lat":36.69, "lon":-93.21"

how do I get it back to {"name":"cvt", "label":"My Office","lat":36.69, "lon":-93.21}

Any help would be much appreciated. Thank you

0 Likes

#2

By default Mqtt delvers strings. Depending on the version of Node-RED you have, you may be able to set it to deliver JSON instead.. If not then the JSON node should fix it for you.

0 Likes

#3

Thank you dceejay! However I did try the JSON node as that seemed obvious and thats what I have it set to on the inject but I get an error...

"Unexpected token : in JSON at position 6" when I run it through the json node... I know I am missing something simple but its got me.

0 Likes

#4

Also actually this one line is coming in on an array and I am pulling this one line out as a string. But its got those darn "" around it and they need to be {} LOL

0 Likes

#5

OK I think we need to see what you are really trying to do. Attach a debug node to the mqtt node and show us the real output.

0 Likes