Get JSON Value
A JSON file as your config panel
- value
Somewhere between "typing the same prompt into six widgets" and "building a full API server" sits the workflow that wants its settings in one place. That's what UC_GetJsonValue is for: it reads a JSON file full of named values, picks one, and hands it to the graph with its type intact - a number stays a number, a string stays a string, a list stays a list. Change the file, re-run, done. No node surgery.
It's a value-node problem, the same family as the "Convert widget to input" mechanic: one authoritative source, many consumers. Instead of a primitive widget it's a file, which means you can keep an entire batch's settings in one values.json and have a whole pipeline of nodes pull from it. Pair it with the pack's parameter nodes and you've got a workflow whose "panel" is a text file you can edit without touching the graph.
How it works
You point it at a file and pick a selection mode. The file must contain a top-level JSON object of named values - flat keys, each holding any JSON value. Then:
keymode returns the value at a named key.randommode returns a deterministic random pick seeded by theseedinput - same seed, same value, every run. This is the party trick: reproducible randomness without touching the graph.indexmode returns the value at a zero-based insertion-order index.
Errors are loud and specific: missing file, undecodable JSON, a top-level list instead of an object, a key that isn't there, an index past the end - each raises a clear message rather than failing silently mid-pipeline.
The inputs that matter
json_path- defaults to./input/values.json, which is the natural place for it since that's ComfyUI's input folder. Relative paths resolve from the ComfyUI working directory.selection_mode-key,random, orindex.key/index/seed- only the one matching your mode matters; the others are ignored.
The single output is value, typed as * because it can be anything. It feeds whatever the JSON contained.
Installing it
ComfyUI Manager → search "ComfyUI-UtilsCollection", or clone it in:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart. Dependencies are opencv-python and typing-extensions - nothing heavy, no models. As with everything in this pack, it uses the newer ComfyExtension API, so keep ComfyUI current.
Where it trips people up: the file has to be written before the node runs - there's no editor built in, so have a text editor handy. And the * output type means ComfyUI won't type-check your wiring for you; if you pull a string out of a spot you intended as an int, the mismatch surfaces downstream, not at this node.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| json_path | STRING | ./input/values.json | Path to a JSON file containing a top-level object of named values. |
| selection_mode | COMBO | key | Select a value by its key, a deterministic random choice, or its insertion-order index. |
| key | STRING | Top-level JSON key to use when selection mode is key. | |
| index | INT | 00–9223372036854776000 | Zero-based insertion-order index to use when selection mode is index. |
| seed | INT | 00–18446744073709550000 | Seed used for deterministic random selection. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | * | The selected JSON value in its original JSON type. |