Prettify the json to binary written

Describe the issue/error/question

I can save my json to a file and git add+commit+push it and it works fine… but…

how can I have a prettier json? in js, that is as simple as JSON.stringify(data,null,2), but I don’t see that option on the “json to binary” node.

Am I missing something?

What is the error message (if any)?

no error message, just a json without any space

Please share the workflow

I’m not sue I can share without leaking private data, please advice if needed :wink:

Hi @xavier, welcome to the community :tada:

You can actually use JSON.stringify in n8n if you like. The Function and Function Item nodes let you execute JavaScript code.

After using this method, you can then use the Use Raw Data option of the Move Binary Data node to prevent it from applying it’s own logic:
image

The resulting file will then have the prettified JSON you have in mind and can be further processed:
image

Here’s an example workflow creating such a file and writing it to the hard drive at the end:

Example Workflow
1 Like