How do I convert a binary text list into jSON?

Describe the issue/error/question

I am using ‘read binary’ to read a list from a txt file.
When I load it, the data is only visible in the “Binary” tab when I click “Show Binary Data”

I would like to turn it into a single column table so that it is visible as jSON. Any idea how I would do that?
Thanks in advance

Hi @Nicolai with the risk of asking a stupid question; have you tried the Move Binary Data Node? Move Binary Data | Docs

Oh wow! Thank you. That seems like ecactly what I need.
Not a stupid question at all @dickhoning . These are my first few hours with n8n so I don’t really even know what to look for yet.

I tried it but I got this error:

SyntaxError: Unexpected token y in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.execute (C:\Users\Nicolai\AppData\Local\Programs\n8n\resources\app\node_modules\n8n-nodes-base\dist\nodes\MoveBinaryData\MoveBinaryData.node.js:366:41)
    at async C:\Users\Nicolai\AppData\Local\Programs\n8n\resources\app\node_modules\n8n-core\dist\src\WorkflowExecute.js:451:47

@Nicolai could you possibly provide me with a txt file with (anonymised) sample date and an example of how you want this data to end up in your JSON data?

Thanks @dickhoning I certainly could.
Unfortunately I don’t really know how it should be formatted, I just need to paste it into a spreadsheet column but when I try it as is, nothing happens and I am guessing that is because there is no JSON data.
There’s nothing sensitive in there, so I wont need to anonymise anything.
How do I get it to you?

Here’s a link to a sample text file, inside the zip is a screenshot of the node I am trying to use the data in

@Nicolai unfortunately your link does not work for me …

Im so sorry about that @dickhoning this Google Drive link should work

@Nicolai here’s a workflow to reads in your text file and then splits the data by Newline. I’m not sure how the Google Sheets node works, so you can either feed in your domain names from the ‘Split by Newline’ node or the ‘Item List Data’ node. Good luck and enjoy!

Nearly forgot to give credit to Borislav Hadzhiev for his article on How to Split a String by Newline in JavaScript | bobbyhadz

2 Likes

That is terrific. Thank you so much @dickhoning That was so very kind of you.
The data is all there now. I just have to figure out how to make Google Sheets accept it.
It currently gives me this error

ERROR: Bad request - please check your parameters
Invalid value at 'data[0].values' (type.googleapis.com/google.protobuf.ListValue), "galeriefritz.com" Invalid value at 'data[1].values' (type.googleapis.com/google.protobuf.ListValue), "psjza.com" Invalid value at 'data[2].values' (type.googleapis.com/google.protobuf.ListValue), "proxyinjector.com" Invalid value at 'data[3].values' (type.googleapis.com/google.protobuf.ListValue),

But that’s not too surprising though as I am still just figuring this out.
I couldn’t have made it here without your help. I will study the workflow to learn how to do it again in future. Thanks again!

1 Like