Appeal for aid Cut special characters

"[["M","O","2","3"],["1","2","3","4"],["5","6","7","8"]]" To MO2312345678 Must use function?

Hi.

You have put this question in the developing nodes category. Are you really developing a brand new contrib node or are you just using node-red?

As for your question, can you paste a small screenshot of this data as seen in the debug node, so we can see what type it is?

Also, it would be helpful to know where this data I came from.

As long as the structure doesn't change then you can just use split and join nodes... eg

[{"id":"35c64aa2401bf14f","type":"inject","z":"e308df9c84a9999b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[[\"M\",\"O\",\"2\",\"3\"],[\"1\",\"2\",\"3\",\"4\"],[\"5\",\"6\",\"7\",\"8\"]]","payloadType":"json","x":230,"y":1260,"wires":[["f7e538e621fc35df"]]},{"id":"f7e538e621fc35df","type":"split","z":"e308df9c84a9999b","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":230,"y":1320,"wires":[["158c6aeeb6fe4e71"]]},{"id":"84bce4c1a18d10e9","type":"join","z":"e308df9c84a9999b","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":230,"y":1380,"wires":[["1dfbaec560d63258"]]},{"id":"158c6aeeb6fe4e71","type":"split","z":"e308df9c84a9999b","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":390,"y":1320,"wires":[["84bce4c1a18d10e9"]]},{"id":"1dfbaec560d63258","type":"join","z":"e308df9c84a9999b","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":390,"y":1380,"wires":[["e1680526b32a9a2c"]]},{"id":"e1680526b32a9a2c","type":"debug","z":"e308df9c84a9999b","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":400,"y":1440,"wires":[]}]

If you must use a function

[{"id":"4573c103df43767a","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[[\"M\",\"O\",\"2\",\"3\"],[\"1\",\"2\",\"3\",\"4\"],[\"5\",\"6\",\"7\",\"8\"]]","payloadType":"json","x":450,"y":2720,"wires":[["94ea8af734c14bfa"]]},{"id":"94ea8af734c14bfa","type":"function","z":"b779de97.b1b46","name":"function 147","func":"msg.payload = [].concat(...msg.payload).join(\"\")\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":2720,"wires":[["b64b6d29e065d2f3"]]},{"id":"b64b6d29e065d2f3","type":"debug","z":"b779de97.b1b46","name":"debug 2455","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":2720,"wires":[]}]
msg.payload = [].concat(...msg.payload).join("")
return msg;

Output

MO2312345678

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