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 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
Node-red-node-pi-gpiod true/false vs. 0/1
Listen to udp and parse the snmp in it
No debug output in side-bar. Tried lots, stuck, please help
IBM Watson Sensor Support
Sending data to Firestore using MQTT
Kalman filter not working
Node-red doesn't run anymore
MQTT & POSTGRESQL on Raspberry
Multiple DS18B20 temperature sensor (Tasmota->NodeRed->InfluxDB))
Controlling Relay
HEX color light state
Help SQLite error
Problems with layouts using groups
Set context array not working
Dashboard Form -> python3-function node
Data from Multiple Arrays to a single Array
RSS feed on dashboard
How to read xml external file
BACnet write property
Gridview with CRUD option in template node
Detect when context's variable changes its value
The right logic for this task
Changing the inject node repeat option from UI
Node-Red Sending Unencoded text or filenames over email Instead of photos
Basics,Faster LED Blink,Set/Get function: mosquito into an elephant
Problem Getting Image in Template Node
Trigger a message payload based on input from parallel port
Led question start
Function to compare ds18b20 to numeric value
Mysterious Startup notices
Sum function of two sensor data
Error: getaddrinfo ENOTFOUND
2 flows data combined into 1 graph
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
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
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
Textarea is not holding the value
How can I convert char code numbers to string characters?
Node-RED Dashboard: Some simple questions
Case triggered storing
Test if the file exist
Storing energy data
Switch with indicator
Email send failed. Error 3392 ssl3_get_record:wrong version number
Sum up three outputs from mqtt

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

Paul

3 Likes