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.

ViewBest for
CanvasLayout, loops, dragging steps, step settings panels
JSONBulk 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).

Note

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:

ActionWhat it does
Export JSONDownloads the workflow graph
ImportLoads 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 JSONOpens a read-only window with search and a copy button. It does not change the editor.

Edit and apply

  1. Open JSON mode

    Click JSON in the toolbar.

    You should see the workflow as JSON: a workflow_id and a steps list.

  2. 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.

  3. 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.

  4. Check it

    Click Dry-run to check the result. See Dry-run validation.

ControlWhat it does
Unsaved badgeThe JSON differs from the canvas (since you entered JSON mode or last applied)
ResetReloads the JSON from the current canvas and discards edits you have not applied
Apply to canvasDisabled 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:
InsertMeaning
{{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:

  1. Put the cursor inside a "script": "..." value (a top-level step or a loop body step).
  2. Click Edit script.
  3. Edit the code in the Lua editor.
  4. Click Save to JSON, then Apply to canvas.
Tip

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:

ShapeExample
Steps graph{ "workflow_id": "...", "steps": [ ... ] } (what the editor shows)
Steps only{ "steps": [ ... ] }
Canvas export{ "nodes": [ ... ], "edges": [ ... ] }

Limits of the JSON view

Not availableWhat to do instead
Hover help for each fieldUse Step types
Red underlines from a schemaRead the Workflow JSON bar, then run Dry-run after applying
The canvas updating while you typeClick Reset to reload from the canvas

Common problems

ProblemWhat to try
Apply to canvas is disabledThe bar is red (the JSON is invalid) or nothing changed. Fix the error shown in the bar.
Your edits vanishedYou clicked Reset, or discarded changes when switching to Canvas.
A step shows "unknown field" in a dry-runCheck the field name in Step types.

Next steps

Edit this pageagentruntime-io/agentruntime-docs