Thank you @Steve-Mcl its working now without any errors. I figured out a fix for it and while the .json format was fine by itself , msg.payload could only be used with as a function block. when I try to use the same .json code in the inject node as a .json input itr gives me error unless I remove the msg.paylaod line and return.msg line.