Maniuplating a msg:string so I can make it a msg.payload?

I have a payload that gets returned from a powershell node, which produces data as requested. However, the debug shows the format as msg:string
I've been unsuccessful finding any documentations on how to point to this, as it is not in a format that I know how to fix. Traditionally I'd use a change node, and I suspect it is the solution, but I'm not sure how to reference it with the given drop downs.
When I try msg: in the selection, nothing returns any value - payload, string, payload[0], payload {}, {{{payload}}}, {{{string}}}, {{payload}}, {{string}}…… and so on.
my two debugs tell a different story from the output of the node...
my msg.payload shows msg.payload: undefined, while my complete msg object shows msg:string[18] and the legit string value I expect as an output.

So, I'm lost. I can't move it, change it, reference it or anything. Can someone point me in the right direction to find information on how to turn a msg:string into a msg:Object or a msg.payload or anything that I can then manipulate?

Thanks,
Walt

'''[{"id":"db1a64d6.8e8208","type":"inject","z":"81323c0a.33f3b","name":"","topic":"","payload":"[System.Security.Principal.WindowsIdentity]::GetCurrent().Name","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":180,"wires":[["2cf71aee.91e706","5a6b9a71.ccf994"]]},{"id":"2cf71aee.91e706","type":"powershell","z":"81323c0a.33f3b","name":"Get User Name","x":280,"y":280,"wires":[["bdac8ce3.b7df9","e0e1362e.378698","70ad3c72.1c1aa4"],]},{"id":"e0e1362e.378698","type":"debug","z":"81323c0a.33f3b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":230,"y":360,"wires":},{"id":"70ad3c72.1c1aa4","type":"debug","z":"81323c0a.33f3b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":550,"y":480,"wires":},{"id":"f1098998.1d0cc8","type":"comment","z":"81323c0a.33f3b","name":"initiate action","info":"","x":90,"y":140,"wires":},{"id":"ba4a226f.b9cd","type":"comment","z":"81323c0a.33f3b","name":"grabs AD USER NAME from your computer and returns a raw string to msg:","info":"","x":330,"y":240,"wires":},{"id":"3af3306d.4bd42","type":"comment","z":"81323c0a.33f3b","name":"the msg.payload shows nothing because the data is written in the root of the msg ","info":"","x":300,"y":320,"wires":},{"id":"f1a0d76c.4d0b58","type":"comment","z":"81323c0a.33f3b","name":"the "show all" will show that the only thing getting passed is a string, and where it lives","info":"","x":680,"y":440,"wires":}]

Hi @WalterWhite, see the other topic, it's caused by a bug in the node. I added a patch there. The issue however isn't so simply fixed throughout the flow, so you're better off patching the code yourself. What is happening is that rather than an object is outputted by the node, with a property "payload" set in that object containing the actual payload, the payload is outputting. This also causes other properties to be missing. As Node-RED requires messages to be objects, this means it can't be fixed through the "usual solutions" like utilising the change node to move the properties around. After all, there are no properties on a string.

For future reference, your code can't be imported. The forum software changes the empty [] brackets to a single square unicode character. See the explanation topic on how to export code and post it on the forums so that others can import it: How to share code or flow json

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.