Dictionary Get
Pull one value out of a DICT without killing the workflow when the key's missing
- dictionary
- STRING
VixDictionaryGet is the read side of the ComfyUI-Visionatrix dictionary toolkit. It takes a DICT and a key, and hands you the value as a string - with a graceful fallback if the key isn't there. It's the node you use after VixDictionaryNew or VixDictionaryConvert to actually get something out of the structured data you built.
The value here is the "safe" part. Lookups that miss don't blow up the workflow; you get the default_value instead. In a graph where data comes from user input or parsed text, that's the difference between a graceful "not set" and a hard error mid-run.
Inputs
- dictionary (DICT) - the dict to look in. Wire this from VixDictionaryNew, VixDictionaryConvert, VixDictionaryUpdate, or anywhere else a DICT comes from.
- key (STRING) - which key to fetch. Exact match, case-sensitive, spaces count.
- default_value (STRING, optional, default
"") - what to return when the key is missing. Leave it empty and you get an empty string.
Outputs
One STRING output with the value - or the default, if the key wasn't found. Two things worth knowing about the return: it's always cast to a string, and it's dict.get()-based, so even a stored empty string or None value returns cleanly instead of erroring.
How it works
The implementation is str(dictionary.get(key, default_value)) - about as simple as it gets. get returns the default rather than raising, and the outer str() normalizes whatever type the stored value was. Note that means numbers stored as numbers come back as strings ("30"), which is fine for text consumers and occasionally annoying for numeric ones.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Visionatrix/ComfyUI-Visionatrix
Restart ComfyUI, or install ComfyUI-Visionatrix via ComfyUI Manager. No model downloads; deps are torch, pillow, numpy.
Gotchas
The string-coercion surprise is the one to internalize: everything you read back is a string, regardless of how it was stored. If VixDictionaryConvert parsed {"steps": 30} and you Get steps, you get "30" - wire that into an INT input and it'll mostly convert, but strict nodes may complain. Second, key matching is exact and unforgiving: "steps" and "Steps" are different keys. And if you find yourself calling Get on the same key in a dozen places, consider whether you actually need a dict at all - this family shines when one DICT wire replaces many parallel wires, not when it adds friction.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| dictionary | DICT | — | |
| key | STRING | — | |
| default_valueopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |