There seems to be some confusion as to what is meant by the term JSON. Am I correct in saying that JSON is a string representation of an object, and is therefore always a string. So these, for example are not assigning JSON values
msg.payload = {"a": 0, "value": "fred"}
msg.payload = {a:0, value: "fred"}
whereas this is assigning a JSON value
msg.payload = '{"a": 0, "value": "fred"}'