Save JSON
Writing any JSON blob in your graph to disk
- json_data
- ui_widget
- json
A handful of nodes in this pack produce JSON as a byproduct - LF_CivitAIMetadataSetup's analytics_dataset, LF_CompareImages's dataset, LF_LoadMetadata's extracted metadata - and none of that persists past the session unless you actually write it somewhere. LF_SaveJSON is the plain, no-frills answer: it's a save node for JSON data, the same role SaveImage plays for images.
Three inputs: json_data, the JSON value you're writing; filename_prefix, the path and filename (slashes work for subdirectories, same convention as ComfyUI's image save nodes); and add_timestamp (on by default), which appends the execution time to the filename so repeated saves don't overwrite each other. There's an optional ui_widget slot rendering a tree view of the data on the node - useful for eyeballing what you're about to save before it hits disk.
The single output, json, re-emits the same data you fed in - so saving doesn't dead-end the wire, and you can keep using that data further downstream in the same run even after archiving it.
Where this actually gets used in practice: archiving the JSON side-outputs the rest of this pack produces without a home of their own. LF_CivitAIMetadataSetup's analytics_dataset, LF_CompareImages's comparison dataset, or a batch of LF_ExtractString results assembled into one object - none of those have a dedicated save path otherwise, and LF_SaveJSON is the generic catch-all for "I want a record of this on disk" without writing a custom logging step yourself.
Installing it. ComfyUI Manager: search "LF Nodes," install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/lucafoscili/lf-nodes, then restart. Use that repo - comfyui-lf, linked from comfy.icu, is the pack's original, now-archived home; the author's active development is at lf-nodes. No models, no heavy dependencies, this is plain file I/O.
Where people get tripped up. If nothing's showing up where you expect on disk, remember filename_prefix is relative to ComfyUI's output directory by default, the same convention every other save node in ComfyUI follows - an unqualified prefix like metadata/run lands in a metadata subfolder under your normal output path, not at the filesystem root. Second, since add_timestamp is on by default, don't be confused by filenames that don't match exactly what you typed in filename_prefix - check for the timestamp suffix before assuming the save failed. And this node saves whatever JSON structure it's given, with no schema validation of its own - if the thing you're archiving is malformed or incomplete, that's what lands on disk; check the data upstream if you need the saved file to be trustworthy for later use.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| json_data | JSON | JSON data to save. | |
| filename_prefix | STRING | Path and filename for saving the JSON. Use slashes to set directories. | |
| add_timestamp | BOOLEAN | true | Add timestamp to the filename as a suffix. |
| ui_widgetopt | KUL_TREE | [object Object] | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json | JSON | — |