Dictionary Lookup
Pull One Value Out of an Object
- dictionary
- lookup
- keys
ComfyUI workflows keep accumulating structured data - CSV rows parsed into objects, JSON responses, metadata bundles - and then you discover you can't just grab one field out of them. That's this node's whole job: hand it an object and a key, get the value back as a string, plus a bonus output listing every key in the dictionary. It's the bridge between "data lives in a dict" and "data is a string my next node can actually use."
How it works
Two required-ish pieces of setup, three outputs:
dictionary(required) - an OBJECT. This is the thing you're looking inside. TinyBee's CSV Parser'sdict_listoutput is a natural source, as is the JSON Parser node or any node that emits an object.key- which field you want. Leave it empty and you get thedefault_valueback.default_value- what to return when the key isn't found. Defaults to an empty string.
Outputs:
lookup- the value as a string, or the default if the key is missing.keys- every key in the dictionary, as a list. Handy when you don't remember the exact field names, or when you want to drive a loop over whatever a CSV happened to contain.
One nice bit of resilience: the node accepts its dictionary as either a real object or a JSON string. If you hand it a string that parses as JSON, it decodes it before looking anything up. Parse failures just become an empty dict rather than a crash. The value is always returned stringified - which is the catch, since a numeric value comes back as text and you may need TinyBee's String to Int / String to Float casting nodes to convert it back.
There's also a lookup debug print that goes to the ComfyUI console on every run. It's noise for batch runs, but genuinely useful the first time you're trying to figure out what a dict actually contains - you'll see the parsed dictionary echoed back before the result.
Where you'd actually use it
- CSV row access: parse a CSV to
dict_list, then pull the "prompt" column out of each row object by name. - Metadata plumbing: read a field out of an object produced by File Metadata or a JSON parser, then feed the string into a conditioning node or text box.
- Discovery: wire a freshly parsed object in and use the
keysoutput to see what fields exist before you build the rest of the workflow.
Installing it
Standard TinyBee pack install (this one lives under 🐝TinyBee/Dictionaries):
- ComfyUI Manager → Install Custom Nodes → search "ComfyUI-TinyBee" → Install, then restart ComfyUI.
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
Restart after cloning. No models, no meaningful dependencies - this node is pure Python dict work, and the pack's only real extras (pillow, jsonata) aren't touched by it.
Gotchas
Two things. First, remember you get a string back, not the original typed value - a boolean in the dict comes back as "true", an int as "5". Convert when you need the type. Second, default_value is also a string, and an empty default is the only "not found" signal you get, so if your data legitimately contains empty strings you can't tell "missing" from "empty". That's usually fine for prompt work; just be aware of it. And if the dictionary is huge, the per-run console print adds up - it's debug output that can't be turned off.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| dictionary | OBJECT | — | |
| keyopt | STRING | — | |
| default_valueopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| lookup | STRING | — |
| keys | STRING | — |