A ComfyUI workflow is more than a picture of connected boxes. It is a data structure that tells ComfyUI which nodes to create, what values to use, and how tensors move through the graph. This comfyui workflow and mapping json tutorial shows how to read that structure, edit it without quietly breaking dependencies, and save a result another person can reproduce. The examples use a Wan2.2-style video graph, but the same method applies to image, upscaling, and ControlNet workflows.
The test setup for this guide is deliberately ordinary: Windows 11, ComfyUI portable, an RTX 3090 with 24 GB of VRAM, Python 3.11, and a fixed seed. I use the current ComfyUI build available on the test date, record custom node versions, and keep model filenames in a separate notes file. A JSON export alone does not preserve every dependency. If you cannot identify the checkpoints, VAE, custom nodes, and settings, you have only part of the experiment.
What the JSON actually contains
ComfyUI commonly exposes two useful JSON formats. The API format is a compact mapping where each key is a node ID and each value contains a class type plus an inputs object. A simplified entry looks like this in plain language: node 12 is a KSampler, its seed input is a number, its model input points to node 8, and its positive conditioning points to node 21. The visual workflow format contains additional information for the editor, including node positions, sizes, labels, and link records.
The distinction matters when a script expects one format but receives the other. The API format is convenient for queueing prompts and changing values programmatically. The visual format is better for opening, inspecting, and rearranging a graph in ComfyUI. Before editing, open the file in a text editor and search for class_type, inputs, and links. Those three areas tell you whether you are looking at executable graph data, editor metadata, or both.
In a mapping JSON file, IDs are usually strings even when they look numeric. Treating "12" and 12 as interchangeable can produce confusing lookup errors in JavaScript or Python. Keep IDs stable while debugging. Renumbering every node makes a file look tidy but makes comparisons with an earlier render harder.

Reading nodes, inputs, and links
Start at the model loader rather than the first node on the canvas. A Wan video workflow may load a diffusion model, text encoder, VAE, and auxiliary model before sampling begins. Follow the references in each inputs object. If the sampler has a model input such as ["8", 0], it means the sampler consumes output slot zero from node 8. A positive conditioning reference such as ["21", 0] points to another node and its output slot.
This is the central idea in a comfyui workflow and mapping json tutorial: a connection is data, not a line painted on the screen. The first value identifies the source node. The second identifies the output index. If you change ["8", 0] to ["9", 0], you have changed the model entering the sampler, even if the canvas still appears reasonable after import.
Inputs that contain ordinary values are parameters. Seed, steps, CFG, width, height, frame count, and denoise strength typically appear as numbers. Inputs containing a two-item array are references to other nodes. A missing reference can cause an immediate validation error; a valid reference to the wrong output can produce a render that completes but looks wrong. That second failure is more dangerous because it wastes an hour before announcing itself.
For Wan2.2 testing, I record frame count and resolution beside the JSON filename. For example, a 480p, 81-frame render and a 720p, 81-frame render can share most of a graph while having radically different VRAM behavior. The settings are part of the result, not decoration around it.
Editing JSON safely
Make one change at a time. First duplicate the original file and give it a descriptive name such as wan22_480p_seed4102_original.json. Then change one value, save, import, and queue a short test. Do not simultaneously replace the checkpoint, sampler, frame count, and prompt. If the output changes, you will not know which edit caused it.
A practical edit procedure is simple. Locate the node by class type and confirm its ID. Check the input name used by that node. Change the value while preserving its data type. Save valid JSON, reopen it in ComfyUI, and inspect the graph before rendering. A seed should remain a number, a checkpoint filename should remain a string, and a link should remain a two-item array. Adding quotation marks around a numeric seed can turn a useful value into an invalid input.
The comfyui workflow and mapping json tutorial approach also helps with automated batches. A short Python script can load the API-style mapping, change the seed, prompt, or output prefix, and write a new file. Before doing that, test the script on three seeds and compare the resulting files. Never overwrite the baseline. A typo in a loop can generate dozens of identical videos while giving the false impression that a parameter sweep ran correctly.
Why imports fail or produce different output
The most common failure is a missing custom node. The JSON can describe a node class, but it cannot install that class. ComfyUI may report an unknown node, skip part of the graph, or open a partial workflow. Note the exact node pack name and commit or release used when the file was created. Manager-based installation is convenient, but it does not guarantee that a recently updated node behaves exactly like an older revision.
Model paths create a second problem. One machine may store a checkpoint under models\diffusion_models, while another uses a different folder layout or filename. Fix the path through ComfyUI's model configuration or select the file through the node interface instead of blindly changing unrelated JSON fields. A filename that looks close is not necessarily the same model.
A successful import can still render differently because of VAE versions, precision settings, attention implementation, GPU offloading, or an altered sampler. For reproducibility, capture ComfyUI version, operating system, GPU, VRAM mode, model hashes when practical, seed, sampler, scheduler, steps, CFG, dimensions, frame count, and render time. This is where the comfyui workflow and mapping json tutorial stops being file trivia and becomes useful engineering documentation.

A small reproducibility test
Take one known-good graph and render a five-second or otherwise short clip with a fixed prompt and seed. Save the original JSON, console log, output video, and a screenshot of the graph. Import the same file after restarting ComfyUI. If the second result differs, compare versions and hardware settings before blaming the JSON.
Next, change only the seed. The graph should remain identical while the output changes. Then restore the seed and change only the prompt. Finally, change one technical value such as frame count. This sequence proves that the file is being loaded and that the intended input is connected to the expected node. If a change has no visible effect, inspect whether the edited node actually feeds the sampler.
I also compare file diffs rather than relying on memory. A clean diff should show the intended seed or prompt change, not dozens of reordered links. If importing and exporting causes broad formatting changes, keep the original API mapping and visual workflow separately. Both are useful, but they answer different questions.
A practical checklist before sharing
Before publishing a workflow, open it on a clean ComfyUI session and confirm that every node appears. List required custom nodes and model files. State the GPU, operating system, ComfyUI version, resolution, frame count, seed, sampler, scheduler, steps, CFG, and approximate VRAM use. Include one expected output and identify known failures, such as flicker, slow model loading, or an out-of-memory error at higher resolution.
Use a clear filename with the model and test conditions. A name like wan22_720p_81f_seed4102.json is more useful than final_workflow_v7.json. Include a short README explaining which inputs are safe to edit and which links should not be touched. If a node is experimental, label it as experimental instead of presenting it as production-ready.
The biggest lesson from any comfyui workflow and mapping json tutorial is that reproducibility is built from boring details. JSON tells ComfyUI what to connect, but hardware, versions, models, and parameters determine what actually happens. Save the settings, preserve the failure, and test one variable at a time. If you cannot reproduce it, it is not a workflow. Run the test. Save the settings. Show the failure.