XAV Save JSON to File
Get your built JSON back out to disk, pretty-printed
- saved_path
The endpoint of the whole pack. Everything you've loaded, navigated, and edited has been living as an opaque handle in memory - this is the node that writes the actual object to a real file, pretty-printed and ready to hand to whatever's next. It's the only node here that serializes, and it's where the chain finally becomes visible.
Two inputs: json_ref (the handle) and file_path (where to write). The source does the housekeeping for you - it creates any missing parent directories, then writes with indent=2 and ensure_ascii=False, so the output is human-readable and non-ASCII text survives unescaped. The output, saved_path, is just the path you gave it, which is handy if you want to wire the filename into another node.
What is it for? Exporting a config you assembled in the graph. Writing a sidecar file - the same shape as the image-plus-text sidecar convention LoRA training uses, except here it's JSON instead of a caption. Checkpointing a JSON you spent twenty minutes building. Or producing the payload an external script or API wrapper reads next. If you're generating requests to a service, or a manifest that some tooling consumes, this is the exit door.
Two gotchas, both grounded in the code, both silent:
The null file. If the ref points at nothing - say you navigated to a missing key - json.dump writes the literal text null to your file. No warning, no error, the node reports success. Walk your Navigate chain before saving, or you'll proudly export a two-space-indented file that contains exactly null.
Overwrite, no questions asked. It writes unconditionally. Whatever was at that path is gone. That's fine for output files, and it's painful if you point it at something you care about. Keep it pointed at a scratch/output location.
One thing it is not: it's not SaveImage. ComfyUI's image save bakes the workflow into the PNG as metadata - this node writes pure JSON text, no prompt chunk, no graph. If you want the reproducibility-shipping-in-the-file behavior, that's the image save path; this is for data.
A natural workflow: XAV Create Empty JSON Object → build it up with the Set nodes → XAV Save JSON to File → confirm the file, then wire saved_path into a follow-up node or just open it. Four or five nodes, and the only thing that ever touches disk is this one.
Install is genuinely zero-dependency - the pack uses only Python's standard library, no pip install, no models. ComfyUI Manager → Install Custom Nodes → search "ComfyUI XAV JSON Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/XAV-Games/ComfyUI-XAVJsonNodes
Restart ComfyUI and the pack shows up under Add Node → XAV/json.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_ref | STRING | — | |
| file_path | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| saved_path | STRING | — |