Arduino with Json to node red to make a chart

Hey. My task is to send some numbers to node red and make a chart with them.
I have to use the Form {"Temperature":22.0,"Humidity":32.0}
When I am in node red I go from the Serial Inport into a json and from that into a function with "msg.payload = msg.payload.Temperature
return msg;"
but it doesn't work. I got the error Unexpected token : in JSON at position 0"
I don't know what to do.

connect a debug node (set to display complete object) - see what is coming into node-red

My guess is one of 3 things...

  • your data is arriving in NR badly formatted (debug msg will reveal this)
  • either its ariving in NR as a string (so you need to convert to Js object)
  • you should be accessing msg.Temperature not msg.payload.Temperature

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