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 easiest way to do that is to paste in your code or flow json, select it all, then click the 'Preformatted Text' button in the toolbar:

image

This will automatically insert 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.

[{"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.

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

10 Likes
Temperature date from xiaomi
How set the output variable "{{msg.payload}}" in JS?!
Embed Node-RED into mean express on the same port in an iframe
Dashboard not appearing
UI-Template DataBase Help
Can't upgrade npm from 6.9.0 to latest on raspian stretch
Conflicts switch- / template node
Node-Red connection issues
Error with function
How many messages are "flowing" in my NR?
UI Dropdown - Populating Data
Multiple Sensor Data Using Arduino
Dowloading a CSV-file via dashboard button
PLC connection dosen´t work
Button on click popup number pad
Parsing txt file
Automatique or manual mode
Read and write a json file - solved
Error, sslv3 alert handshake failure
HTTP Request response changed 0.20.2 upgrade
Values color - gauge
In node-red how to store message for using in flows
While running the flow getting servet time out error
Help with injecting a boolean value into a payload?
The workspace contains some nodes that are not properly configured
Trigger a flow from external call (QUESTION)
Writing using file node UTF-8, encoding becomes iso-8859
MSSQL 2 instances same server, 2 different databases
Strange behaviour of assign of context var with init bool value
Delay in Function
Trouble updating chart.js chart with msg.payload
About delay node
Welcome to the Node-RED Forum!
Modbus/Arrays extract divide and give in stream
About the Dashboard category
JSON parse error
JSON parse error
No update in Domoticz
Help with a function node
SNMP Set - NoSuchName
Dashboard - How to add OK or Cancel button
From array message, get specific columns
Compare inside temp to outside
Dashboard - How to add OK or Cancel button
HomeKit Garage Door Opener (Raspberry Pi)
Switch node and Object message
Datatype error for fieldbus node
Return msg from ui_template node
Code question from a dopey newbe[solved]
"TypeError: msg.payload.split is not a function"
Firebase and nodered help!
Notification based on input
Static Text in the Dashboard Titlebar?
Access data in template node using mustache
Need help on how to change UI text icon color with input value from Serial Node
Cumulative running time
Live gpio timer duration to lcd
If ( var1 = true and var2 = true ) then / else
Pausing timer in mytimeout
Simple sum gives wrong answer ... I am using get and set
Aosong AM2315 temp/rh
Node-Red Dashboard Graph
Dashboard using template node
node-RED can not be opened anymore
RED.httpAdmin.get not refreshing JSON
Read from mysql db
NLC node fails to connect NLC instance on IBM Cloud
Problem using ng-change directive with Dashboard Template
Create an admin configuration API HTTPS endpoint
Switch Node with time
How can I get array components values
Nodes suggestion for timed rolling average and desynchronised sum
Returnvalue in function-node from async action-node
How To Make Logging Data Values in Chart
Trying to retrieve info from a website problems, I'm just a rookie
Special character encoding /Utf8 problem
MySQL NODE-RED table
Function to store data from csv to table?
How can i append to PDF file in Node-Red?
Error: Cannot find module 'i2c-bus'
I have some questions relating database
Question for evaluation rfxcom-out
"Rich File Manager" in node-red
Jsonata: return value from context array
Arduino serial data and alarms
ReferenceError: SunCalc is not defined
How to do a simple sum of two msgs which are arrays
Passing an input to exec node which execute a python script
How to make a counter incoming\outgoing on two sensors?
Virtual keyboard in any text fields
Access msg.payload in script tag
Write Slide Value
How to convert to a function
How to convert to a function
Dropbox folder sync
Newbie here using Hassio
Return triggers Maximum call stack size
URL variables http get request
Visibility images via ui_template
PCF9685 Dimmen slow
Node-red mongodb update record
Test of a sensor
Cryptomining Malware Infecting Node-RED servers
Accessing global variables from a custom node
Representing locations in worldmap
Create json object in flow
How to make an IoT protocol (parsing, answering)?
Import querySelector function
Passing msg.payload to template node
Blog site using Mongo db
Node red sms app
Trouble with UTC and lighting automation
Can't get the blog post
EXAMPLE (template) - displaying a two dimensional table
Function not working after update
Return value from OPC.IIoT.Result-Filter
Can node-red node/flow run in parallel?
Speeding up picture taking
Newbies forum/section?
Three backticks
How to access payload in mustache template under script tag
Node-red influxdb invalid boolean
Please help me..pilcd doesn't work(raspberry pi+16x2lcd)
Time control using a switch
Trouble Registering Custom Node
HTML to activate GPIO
Help with extraction of data from csv file
I have a problem with the hue - switch
Trouble Registering Custom Node
Node-red raspberry pi multiple input
Wait for page load before make Get request
Using array loop
Error sending OPC UA variable
Listen to udp and parse the snmp in it
Three way light switch emulation
Yeelight rainbow mode
Posting flows in Node-RED forum
Delay node problem with override
Audio file playback and stopping playback
Don't know how to pull flow context without quotations in a template
Node-red-dashboard has gone blank
Mysql database in dropdown node
Who can help me improve my node (homekit)
Introduce inputs in exec node
Mysql database in dropdown node
Send values to an array, write to CSV when full
Extracting data from msg.payload
#3

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

Paul

3 Likes
Node-red Exec node python code with Mac
Send a mail using Node RED
Link Node don t find new links
Start node-red on boot doesn't find python module in exec node
In node red drop down node not giving expected result incase of one selction item
Plot a time series using highcharts
Passing (msg.payload) in exec node to a python script function
Automatic restart Node Red on Linux
Local weather group for Dashboard
Saving a JSON array in an excel file
Yeelight rainbow mode