JSON Load File From Folder (Soze)
Walk a folder of JSON files by index
- Json_Contents
- Formatted_Json_Contents
- Minified_Json_Contents
- Filename_Path
- Filename
- Filename_No_Ext
Same idea as the pack's image folder loaders, but for JSON files: point this node at a directory of .json files - per-image metadata, per-item configs, exported sidecar data - and it loads one file per run, walked by index. It's the file-system counterpart to JSON Array Iterator, useful when your data lives as separate files rather than one big array you'd otherwise have to assemble by hand.
This is the kind of node that earns its place in dataset-adjacent workflows: if you're processing a folder of images alongside a folder of matching JSON metadata (captions, tags, generation params), this node is what lets the metadata side keep pace with an image loader stepping through the same index.
How it works
Give it a folder path and an index; it reads the JSON file at that position in the folder listing and hands the contents back three ways - raw, pretty-formatted, and minified - plus the filename in a few forms, so you don't need a separate node to extract the name for labeling or matching against your image folder.
The inputs and outputs that matter
json_folderpath- required. The directory containing your JSON files.index- required, default0, range 0 to 1,000,000. Which file in the folder to load. Pair this with the same index driving an image loader elsewhere in your graph if the two folders are meant to line up file-for-file.- Output:
Json_Contents- the raw file content as loaded. - Output:
Formatted_Json_Contents- pretty-printed, for readability. - Output:
Minified_Json_Contents- compact, for passing along. - Output:
Filename_Path,Filename,Filename_No_Ext- the file's path and name in a few forms, handy for matching against a corresponding image or logging which file you're currently on.
How to install it
ComfyUI Manager - search "Quality of Life Nodes for ComfyUI" or "Soze" - or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt
Restart. No models or heavy dependencies; a folder of JSON files and a filesystem path are all this node needs.
Common issues & troubleshooting
Index and image loader fall out of sync. If you're pairing this with an image folder loader to match metadata to images file-for-file, both need the exact same sort order and the exact same file count - if one folder has an extra file (a stray .json with no matching image, or vice versa), your index will drift and start pairing the wrong metadata with the wrong image partway through. Keep the two folders in lockstep, ideally with matching filenames rather than relying purely on directory order.
Folder path doesn't resolve. As with any of the pack's folder-based nodes, use an absolute path rather than a relative one if the workflow is going to run outside the directory you tested it in - relative paths resolve against wherever ComfyUI's process happens to be running from, which isn't always obvious, especially on a hosted or containerized instance.
A file in the folder isn't valid JSON. This node will presumably choke on it the same way any JSON parser would; if a run fails partway through a folder walk, check the specific file at that index for a syntax error (a trailing comma, a stray comment) before assuming the node itself is broken.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_folderpath | STRING | — | |
| index | INT | 00–1000000 | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| Json_Contents | STRING | — |
| Formatted_Json_Contents | STRING | — |
| Minified_Json_Contents | STRING | — |
| Filename_Path | STRING | — |
| Filename | STRING | — |
| Filename_No_Ext | STRING | — |