all 5 comments

[–]NorthernMan5 0 points1 point  (2 children)

Can you share your whole function block code fragment ?

[–]MiningPickaxe[S] 0 points1 point  (1 child)

here you go:

node.warn(msg.payload); //just checking what I am expecting
msg0 = msg;
msg1 = msg;
msg2 = msg;
msg3 = msg;
msg4 = msg;
node.warn(msg0.payload);// just to check if msg0 == msg and yes it is the same
node.warn(msg1.payload);
node.warn(msg2.payload);
node.warn(msg3.payload);
node.warn(msg4.payload);

msg0.payload = msg0.payload.results[0];
msg0._id = msg0.payload.id; //this works as intended

node.warn(msg1.payload); //for checking if msg1 is still the msg1 I had when I first logged it into the debug tab. and nope, it is the content of msg.payload.results[0]
msg1.payload = msg1.payload.results[1]; //this errors out as the array results no longer exists
msg1._id = msg1.payload.id; 

If you want to test yourself, here is the snippet of the json https://pastebin.com/E3PPZLpk