How can I run example flows provided as JSON snippets?

Hello,

I have been reading forum posts and I see that answers often contain example flows as JSON snippets. It is a very attractive feature of Node-Red that flows can be shared as clear text but what is the best way to run an example flow provided as JSON text?

Where would I paste the example JSON code, into my flows.json file?

I don't want to break anything that I have working.

Should I save my working flows.json off to a temporary location and replace its contents with the example snippet? How do you guys work?

In the node-red editor go to import, paste the code there and click the button.

Sometimes NR complains that its not valid code.
Sometimes it imports but you get a bunch of "unknown" nodes.
Occasionally it successfully imports,into the current flow or a new one, you have to take pot luck.
You can then decide whether to deploy or ctrl-z to undo the import.
Actually even if you import and undo, you will often find configuration nodes and dashboard groups have been created.

In the light of the above, I never import code from here onto my working Node-red servers.

I have a collection of Raspberry Pies for such imports.

The docs here explain importing and exporting flows, Importing and Exporting Flows : Node-RED . As well as the editor workspace, pallette and sidebars.