How to share code or flow json

To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly.

The easiest way to do that is to click the 'Preformatted Text' button in the toolbar:


Then paste in your code or flow json.

You should end up with three back-tick characters - ``` - on their own line before and after the code.

On standard US English keyboards, this is on the same key as the ~ character.

Using the backticks will ensure the forum does not reformat the code.


You can see the quotes remain untouched.

For code from a Function node, first without the backticks:

msg.payload = "Hello There";
return msg;

And again, with the backticks:

msg.payload = "Hello There";
return msg;

The added syntax highlighting also makes it much easier to read.

This should be used for any code samples, such as flow JSON, JavaScript, html or XML samples.


Also, larger flows can now be saved as a txt or json file and uploaded directly to the post.



Complete beginner here, but I have ended up with tons of listings of "Home Assistant" as the server for Node-Red to connect to. Mauricio Bonani @mbonani wrote a JSON scrubber that I now use every time I import a flow in a post, with the actual scrubber at


Thank you @euromem. Just a small correction, the scrubber was written by Jason Zachow, not by me.


Just to note the advice of pasting in your code then selecting then clicking preformatted text doesn't seem to work reliably - apparently it's better to click the button then paste your text into the newly created 'space'.

1 Like

@dclear thanks - have updated the guidance to match