Dictionary New
Build a key-value dict with up to nine pairs, by hand
- DICT
VixDictionaryNew is the honest way to build a dictionary when you don't have one already: nine key/value text pairs, typed in by hand, one DICT output. It's part of the small dictionary toolkit the ComfyUI-Visionatrix pack ships - along with VixDictionaryConvert, VixDictionaryGet and VixDictionaryUpdate - and it's the entry point for anyone who wants structured data flowing through a graph.
Why would you want a dict in a ComfyUI workflow? Because a single DICT wire can carry several related values at once: model settings, prompt fragments, metadata, whatever. Build it once, pass it around on one wire, and pull individual values out later with VixDictionaryGet. It's not a headline feature - but it's the node the rest of the toolkit builds on.
Inputs
- key_1 and value_1 are required; key_2 through key_9 with their matching value_2 through value_9 are optional. So the minimum is one pair and the maximum is nine.
The important behavior is in the construction: pairs with an empty key are silently dropped. So leave unused slots blank (both the key and the value) and they just don't appear in the output. Keys are plain strings, values are plain strings - if you want typed values, that's not this node's job.
Outputs
One DICT output containing the filled-in pairs, in order. Feed it into VixDictionaryGet to look things up, VixDictionaryUpdate to merge it with another dict, or any DICT-consuming node.
How it works
The source builds a Python dict from the nine candidate pairs and filters out any with a falsy key. Nothing clever, nothing hidden - which is exactly what you want from a build-by-hand node. The trap to keep in mind is that the same key defined twice means the later pair wins, because that's how dict construction works.
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; the deps (torch, pillow, numpy) are already present.
Gotchas
The main thing that trips people up is expecting typed values. Everything here is a string, so if you store "0.5" you'll get back the string "0.5" - any numeric node you feed it to will need to handle that (most convert, but not all). Second, remember the empty-key-dropping rule works in your favor, but an empty value with a filled key is kept as an empty string. And nine pairs is the ceiling - if you genuinely need more, build two dicts and merge them with VixDictionaryUpdate. For most uses - a handful of named settings traveling on one wire - this is the node you want.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| key_1 | STRING | — | |
| value_1 | STRING | — | |
| key_2opt | STRING | — | |
| value_2opt | STRING | — | |
| key_3opt | STRING | — | |
| value_3opt | STRING | — | |
| key_4opt | STRING | — | |
| value_4opt | STRING | — | |
| key_5opt | STRING | — | |
| value_5opt | STRING | — | |
| key_6opt | STRING | — | |
| value_6opt | STRING | — | |
| key_7opt | STRING | — | |
| value_7opt | STRING | — | |
| key_8opt | STRING | — | |
| value_8opt | STRING | — | |
| key_9opt | STRING | — | |
| value_9opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DICT | DICT | — |