#NodeRed json MQTT Payload to CSV File

1 messages · Page 1 of 1 (latest)

gleaming mountain
#

Writing my first node-red flow, following this post on how to edit a json payload for conversion to CSV:
https://medium.com/@ioTnT/writing-data-from-node-red-to-csv-or-excel-without-extra-palettes-472655d490b6

var time = msg.payload.timestamp;
var temperature = msg.payload.temperature;
m = {'Time': time, 'Temperature': temperature };
return {payload:m};

NodeRed isn't happy give me this error message:
Cannot find name 'm'.(2304)

Should I be defining "m" as a variable before use? I'm using exactly what's shown in the example, so either the author was mistaken, or NodeRed changed from 2022 or I'm really missing something... (entirely possible 🙂 )

Thank you very much for any help!

Medium

Node-RED noobs, I feel your pain. There wasn’t a straightforward tutorial on how to do this when I needed one, so I hope this 5-step…

grim talon
#

Otherwise it isn't declared.

gleaming mountain
#

Thank you so much @grim talon that worked!