I am working with node-red where i am returning an object from a function like below...
{task1:"14124.44",task2:"23123.22",task3:"22323.22",_msgid:"33erewfddsfds"}
From the result above i want to get different value separately like e.g. "task1". I tried different things in another function block e.g. msg.payload[0] or msg.payload['task1'] but not succeeded.
Given that the sample you have provided has a _msgid
field this looks like the data is in the root of the msg object, so you don't want to be looking in the msg.payload
So assuming you are in the function node you want to access the field names directly:
var task1 = msg.task1
var task2 = msg.task2
The [number]
notation is for accessing array entries, not named fields, which can be accessed with ['field name']
.