How to share code or flow json


#1

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 forum provides a few different ways of doing it, but the easiest way to do it is to wrap the code with ``` - three back-tick characters. On standard US English keyboards, this is on the same key as the ~ character.

Here’s an example flow shared by just pasting it in:

[{“id”:“bbef23cc.4e7f18”,“type”:“inject”}]

Note how the forum has turned the normal " quotes into smart-quotes and . That is no longer valid JSON and cannot be imported. By wrapping the same JSON in backticks:

[{"id":"bbef23cc.4e7f18","type":"inject"}]

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.


Temperature date from xiaomi
Dasboard not appearing
How set the output variable "{{msg.payload}}" in JS?!
Datatype error for fieldbus node
Compare inside temp to outside
From array message, get specific columns
Embed Node-RED into mean express on the same port in an iframe
#3

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

Paul