Removing " " from payload

Looking for a way to remove " " from a payload as when writing to a file it appears as {"s":"","orig":"","length":0}

I think you need to explain how you are writing it to a file.

I just sent a message to a file and it wasn't as you show it there.

Could you - please - drag select the nodes used then in the top right corner of the window (where the three black/white lines depicting the menu) select export and then past to clipboard.

Then reply to this but before pasting the clipboard, type three ` letters. (Top left to the left of the number 1) then at the end enter another three of them.

That will make it nicer for people to see/access the code.

Then someone may look at it and reply.

Maybe a screen shot too of what the flow looks like.

That's usually pressing the key then dragging the picture into your reply.

Send the data that you are writing to the file to a debug node and post it here so we can see what you are writing.
Show us what you see in the file and tell us what you want there.

No problemo will do once I'm at the pc and it's been rolling around in my head thought I'd throw it out there for a quick win but obv more info is required

Well at the moment it looks like valid JSON, so could be re-imported somewhere else fairly easily. Removing the quotes would make it invalid, so yes we need to see how you really want it to be.

So to go into a bit more depth, I am connecting to a PPPoE router, running a command, i redacted the info from it for these nodes because of security, this presents me with a list of ppp sessions, I need to then remove the text i dont require, i'm positive theres a cleaner way to do this anyway but i am still learning so stay with me, and if you can advise of a better way im all ears, anyway so after the removal and the extraction im left with the payload coming out like this

payload

flow looks like the following

[{"id":"df68bd0c.63e53","type":"tab","label":"PPP Sessions","disabled":false,"info":""},{"id":"1ff4070e.5c5d39","type":"debug","z":"df68bd0c.63e53","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1398.430419921875,"y":294.3611145019531,"wires":[]},{"id":"4a19772b.7bfe4","type":"inject","z":"df68bd0c.63e53","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":159.5,"y":270,"wires":[["259e6ec.7548b92"]]},{"id":"267977cb.0df858","type":"bigssh","z":"df68bd0c.63e53","name":"Command","commandLine":"ppp secret print detail without-paging;","commandArgs":"","minError":1,"minWarning":1,"noStdin":false,"format":"ascii","payloadIsArg":true,"myssh":"4475ae29.a516e8","x":309.7593078613281,"y":422.5370788574219,"wires":[["76b18631.d9633"],["76b18631.d9633"],["76b18631.d9633"]]},{"id":"7a313f31.d65cb","type":"file","z":"df68bd0c.63e53","name":"","filename":"bbgnsimple.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":1376.1259765625,"y":402.50933837890625,"wires":[[]]},{"id":"76b18631.d9633","type":"split","z":"df68bd0c.63e53","name":"","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":true,"addname":"payloadre","x":572.0703735351562,"y":388.78704833984375,"wires":[["72287df2.97a71c"]]},{"id":"72287df2.97a71c","type":"change","z":"df68bd0c.63e53","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"[\\r\\n]+","fromt":"re","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"\" \"","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":663.0703125,"y":336.6202697753906,"wires":[["26e07608.87579a"]]},{"id":"259e6ec.7548b92","type":"ui_button","z":"df68bd0c.63e53","name":"","group":"ef9fb293.7ef02","order":1,"width":0,"height":0,"passthru":false,"label":"Basic","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":299.0369873046875,"y":328.5647888183594,"wires":[["267977cb.0df858"]]},{"id":"26e07608.87579a","type":"string","z":"df68bd0c.63e53","name":"Extract BBGN Custo","methods":[{"name":"getRightMost","params":[{"type":"str","value":";;;"}]},{"name":"trimLeft","params":[]},{"name":"getRightMost","params":[{"type":"str","value":"name="}]},{"name":"delRightMost","params":[{"type":"str","value":"service"}]},{"name":"getRightMost","params":[{"type":"str","value":"profile="}]},{"name":"strip","params":[{"type":"str","value":"\"\""}]},{"name":"delRightMost","params":[{"type":"str","value":"bytes-out=0 last-logged-out=jan/01/1970 00:00:00"}]},{"name":"delRightMost","params":[{"type":"str","value":"remote"}]},{"name":"delRightMost","params":[{"type":"str","value":"limit-bytes-in=0"}]},{"name":"getRightMost","params":[{"type":"str","value":"limit-"}]},{"name":"delRightMost","params":[{"type":"str","value":"routes="}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":839.75,"y":441.0000305175781,"wires":[["17b2f7a5.5337e8"]]},{"id":"17b2f7a5.5337e8","type":"string","z":"df68bd0c.63e53","name":"Extract BBGN Custo pt2 ","methods":[{"name":"delRightMost","params":[{"type":"str","value":"bytes"}]},{"name":"delRightMost","params":[{"type":"str","value":"last-"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1010.25,"y":340.5000305175781,"wires":[["699ba08f.c764e"]]},{"id":"699ba08f.c764e","type":"change","z":"df68bd0c.63e53","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"[\\r\\n]+","fromt":"re","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1256,"y":488.0000305175781,"wires":[["7a313f31.d65cb","1ff4070e.5c5d39"]]},{"id":"4475ae29.a516e8","type":"SSH_Credentials","z":"","host":"xx.xx.xx.xx","port":"xx","userlabel":"username@xx.xx.xx.xx"},{"id":"ef9fb293.7ef02","type":"ui_group","z":"","name":"PPP","tab":"4523497c.b1a5c","disp":true,"width":"6","collapse":false},{"id":"4523497c.b1a5c","type":"ui_tab","z":"","name":"PPP Reporting","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

if i cat the file in my ubuntu the text file it looks like the following

text

As @dceejay suggested, it looks like JSON.

If it is you can use the JSON node to convert it to a javascript object. Try it and see by linking a JSON to a DEBUG node and see what is returned in the debug panel.

1 Like

if i send it through a JSON node then i get the response as {"s":"","orig":"","length":0}

stranger still if i save as a CSV i get the below

image

You have shown us what you get in the file but not what you want there.

I am looking to simply get a unique identifier which is referenced as "bbgnxxxxxx.b4bisp"

image

if i look at the file pre stipped it looks like the following ( info redacted )

image

From your most recent screenshot, you have msg.payload set to a Object with a property called bbgn with a value of bbgnxxxxxx.b4bisp.

Is your goal to just have bbgnxxxxxx.b4bisp written to the file by itself?

The File Out node writes whatever msg.payload you pass it. If you pass it an Object, it will JSON encode it before writing to the file.

If you just one it to write one value from that object, you can use a Change node to set msg.payload to the value of msg.payload.bbgn before passing it to the File node.