For example in the given array; (array is updated with different value every sec)
[93,30,9]
I would like to indicate that 93 is humidity, 30 is temperature, 9 is x in JSON format. [which look something like this ( "humidity": 93, "temperature": 30, "x": 9 ) ]
Any idea what the code is like in the function node?
var humidity;
msg.payload = msg.payload.humidity;
return msg;
For future reference, since they do not contain any special characters, you do not need to put the attribute names humidity, temperature or vibration in quotes.
Yes x = {name: 1}
is identical to x = {"name": 1}
If, however the attribute had unusual characters, a minus sign for example, or a space, or starts with a number, then you would need the quotes x = {"name-1": 1}
as otherwise it will try to interpret the - as a minus sign.
If you were creating a JSON string though (as opposed to a javascript object) then you would need string = '{"name":1}'
in order to build a valid JSON string.