JSON editor
Edit a workflow as JSON in Workflow Studio, with suggestions, a Lua script editor, and Apply to canvas.
On this page
Workflow Studio shows the same workflow in two ways: as a visual Canvas and as JSON. The JSON view is handy for bulk edits, copy and paste, and wiring many steps at once.
Who this is for: people who are comfortable reading JSON. You can build everything on the canvas without it.
What you will do: switch to the JSON view, edit, and apply your changes to the canvas.
| View | Best for |
|---|---|
| Canvas | Layout, loops, dragging steps, step settings panels |
| JSON | Bulk edits, copy and paste, dependencies, tool arguments, loop bodies |
Both views edit the same workflow. Changes you type in JSON do not reach the canvas until you click Apply to canvas.
Switch views
Use the Canvas / JSON toggle in the toolbar. You can also choose Edit JSON in the toolbar's JSON menu ({ } JSON with an arrow).
The toolbar adapts to your window width. In a narrower window the toggle and the JSON menu fold into More (⋯), which offers View JSON (read-only) but not the editor. Widen the window to edit JSON.
A dot on JSON means there are edits you have not applied.
The JSON menu also has:
| Action | What it does |
|---|---|
| Export JSON | Downloads the workflow graph |
| Import | Loads a graph from a file or the clipboard. You review the mapping of tool servers to your own MCP instances before it is applied. |
| View JSON | Opens a read-only window with search and a copy button. It does not change the editor. |
Edit and apply
- Open JSON mode
Click JSON in the toolbar.
You should see the workflow as JSON: a
workflow_idand astepslist. - Edit the JSON
Change steps, dependencies, or tool arguments. The bar at the top, Workflow JSON, shows whether the JSON can be loaded, for example "2 steps, 2 edges", or what is wrong.
- Apply to canvas
When the bar is green, click Apply to canvas. Studio loads the JSON onto the canvas and lays the steps out again.
- Check it
Click Dry-run to check the result. See Dry-run validation.
| Control | What it does |
|---|---|
| Unsaved badge | The JSON differs from the canvas (since you entered JSON mode or last applied) |
| Reset | Reloads the JSON from the current canvas and discards edits you have not applied |
| Apply to canvas | Disabled when the JSON is invalid or unchanged |
If you switch back to Canvas with unapplied edits, Studio asks whether to discard them.
Suggestions
Press Ctrl+Space (or just type) for suggestions that know about workflows.
- Property names such as
id,type,name,depends_on,tool_name,instance_id,for_each_items,for_each_body_steps,script. - Step types after
"type": ":mcp,lua,llm,agent,human,for_each,while,workflow. Inside a loop body:lua,llm,agent,mcp,workflow. - Step ids inside
"depends_on": [": the ids already in the file. - Templates inside string values:
| Insert | Meaning |
|---|---|
{{input.key}} | Start input |
{{steps.step_id.result.field}} | An earlier step's output |
{{run.*}} | Run details (end user or segment) |
{{connection.*}} | Details of the connection the run uses |
{{item}}, {{index}} | The current item and position in a for_each |
- New step snippets on a new line inside
steps: new mcp step, new lua step, new for_each step, new llm step. Each inserts a starter step you can tab through.
See Step types for every field.
Fold blocks
Hover the left gutter next to a line with { or [ and click the arrow to collapse that block.
Edit a Lua script
In JSON, a Lua script is one long string with \n and \" in it. To edit it as normal code:
- Put the cursor inside a
"script": "..."value (a top-level step or a loop body step). - Click Edit script.
- Edit the code in the Lua editor.
- Click Save to JSON, then Apply to canvas.
For long scripts it is often easier to select the Lua step on the canvas and edit it in the step's settings.
What you can paste or import
Apply to canvas and Import accept the same shapes:
| Shape | Example |
|---|---|
| Steps graph | { "workflow_id": "...", "steps": [ ... ] } (what the editor shows) |
| Steps only | { "steps": [ ... ] } |
| Canvas export | { "nodes": [ ... ], "edges": [ ... ] } |
Limits of the JSON view
| Not available | What to do instead |
|---|---|
| Hover help for each field | Use Step types |
| Red underlines from a schema | Read the Workflow JSON bar, then run Dry-run after applying |
| The canvas updating while you type | Click Reset to reload from the canvas |
Common problems
| Problem | What to try |
|---|---|
| Apply to canvas is disabled | The bar is red (the JSON is invalid) or nothing changed. Fix the error shown in the bar. |
| Your edits vanished | You clicked Reset, or discarded changes when switching to Canvas. |
| A step shows "unknown field" in a dry-run | Check the field name in Step types. |