Load JSON File (CCN)
Load JSON File (CCN)
- json_string
- filename
Load JSON File (CCN) is the boring utility node you didn't know you wanted until you've pasted a wall of JSON into a text widget for the hundredth time. It reads a .json file from ComfyUI's input folder and hands you its contents as a plain string, ready to feed into whatever downstream node expects it. The author's own framing in the source is spot on: "useful for storing template workflows or configuration that you want to embed in outputs instead of the actual workflow." If you're building tools that need to carry a JSON payload - say, a metadata template, a config blob, a workflow definition to embed - this is the clean way in.
Mechanically it's a small filesystem node. On load, it walks ComfyUI's input directory recursively and collects every .json file, then presents them as a dropdown (json_file). Pick one, run, and the node validates that the file is actually parseable JSON before returning it - if it isn't, it tells you in the console and returns an empty string rather than silently passing garbage downstream. That validation is the detail that makes it trustworthy in an automated workflow.
Two things matter about how it behaves beyond the happy path:
- It uses an
IS_CHANGEDhook keyed on the file's modification time. That means if you edit the JSON on disk, ComfyUI won't treat the result as stale-cached - the node re-reads it and downstream execution updates. This is the part that makes it actually usable while you iterate on the file. - The dropdown is a widget, not a wired input, so you can't feed a filename in from another node. For that you want the sibling Load JSON File Path (CCN) in the same pack, which takes an arbitrary absolute path as a string. The two are complementary: this one for the convenience of picking from a known list, that one for full-path freedom.
Outputs:
- json_string - the raw file contents as a single string. Wire this into any STRING input (or a node that parses JSON if you need it structured).
- filename - the relative path of the file you loaded, handy for display or for a downstream node that needs to know which file was used.
Install
Part of the ComfyCollectorNodes pack. Install via ComfyUI Manager (search "ComfyCollectorNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/valkymaera/ComfyCollectorNodes
Restart ComfyUI. You'll find it under ComfyCollectorNodes → Utils as "Load JSON File (CCN)". Zero extra dependencies - no pip installs, no model downloads. MIT licensed, like the rest of the pack.
Common issues
The classic gotcha is expecting the dropdown to refresh when you drop a new file into the input folder. The node's file list is built when the node's INPUT_TYPES runs - if the new file doesn't show up, refresh the node or reload the workflow, and it'll appear. The other trap is path semantics: files are listed relative to the input directory, so a file at ComfyUI/input/configs/foo.json appears in the dropdown as configs/foo.json. And if the input folder has no JSON files at all, the dropdown shows the placeholder "No JSON files found" and the node returns empty strings until you add one - that's the designed failure mode, not a bug.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| json_file | COMBO | No JSON files found | 1 options: No JSON files found |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| json_string | STRING | — |
| filename | STRING | — |