Get Workflow KJ(GetWorkflowKJ)
Get Workflow KJ outputs the workflow currently being run as a JSON string.
Get Workflow KJ
Description
Get Workflow KJ outputs the workflow currently being run as a JSON string. It is useful for capturing a snapshot of the graph as part of the generated output: for example, to embed the workflow alongside generated files, or to persist a copy of the workflow to disk during execution.
The node can emit the workflow in two different formats, selected with the format widget:
- workflow: the UI format, i.e. the full graph that can be loaded back into ComfyUI (including node positions, links, and other UI-level metadata). This is the same shape as the
.jsonfiles saved from the ComfyUI interface. - api prompt: the API format, i.e. the prompt structure sent to the backend for execution, which is more compact and does not include UI layout information.
Connect the string output to a text-saving node such as Save String KJ (with a .json extension) to write the workflow to disk.
Inputs
format
- Type: COMBO
- Required: Yes
- Default:
workflow - Options:
workflow,api prompt
Selects which JSON representation of the running workflow is produced:
workflow: UI-format JSON that can be loaded back into ComfyUI to restore the graph visually.api prompt: API-format JSON describing the execution prompt.
Outputs
STRING
The selected representation of the workflow, serialized as a JSON string. If you intend to save it, pair it with a node like Save String KJ and give the filename a .json extension so the result can be loaded again later.
Usage Notes
- The output reflects the workflow being run at execution time, so the generated string includes the current graph, including the Get Workflow KJ node itself.
- Choose
workflowwhen you want a file that can be dragged/loaded back into ComfyUI for visual reuse. - Choose
api promptwhen you need the compact API-format prompt, e.g. for programmatic re-submission or backend tooling. - For archival or sharing purposes, saving the
workflowformat is usually preferable since it preserves the full editor graph.
Comments
Sign in with GitHub to join the discussion.