You will need to be aware of what is in the content of the msg object. Some things cannot be serialised (e.g. functions).
Then you can use a function node with JavaScript standard JSON object which has a serialise capability. This turns a JavaScript object into a string which you can pass and then parse at the other end.
JSON.parse()
reverses the serialise.