Omg so sorry, you're right! I completely forgot the ".payload"!! The error is gone when I input the JSON object with the Inject node now, thanks! I still have it when receiving from the MQTT subscribe node though
So when I inject the JSON payload into the function to retrieve the MAC_Address, I get the correct output on the debug console. However, when I send the JSON object from the MQTT node, I get undefined in the debug console..
I can't say which way is better. The way you show with: msg.payload = msg.payload.MAC_Address
Or using a JSON node.
I am still unsure myself.
I would suggest you use the JSON node only because it reduces the message back to msg.MAC_Address (and/or what ever else you sent)
and that is what you should call it at the other end of MQTT.
Doing it the way you show, you are leaving yourself open to forgetting to not calling a part of the message with the correct name. (or leaving out the .payload part of it.)
That can cause hours of grief and it is not promoting a good way of doing things.
I'm thinking the inject node would be sending the message as expected AFTER the JSON node.
And so if he says msg.payload = msg.payload.MAC_Address it isn't going to work.
I am so confused... I tried that multiple times and just got it to work... Thanks so much for both your help!!! (I'm still trying to wrap my head around all this)
Actually, I was trying to use the JSON node using the double quotes. But by using the JSON node to convert the entire payload and using single quotes, it worked just fine! I can only mark one answer as the solution but both of you helped me out so thank you so much!