Nodes/comfyui-dreambait-nodes/Dynamic Dictionary
ComfyUI Node

Dynamic Dictionary

Bag up any inputs into one DICT and filter on the way out

By drmbt·Created 2 years ago·Updated 7 months ago· 6
Dynamic Dictionary
    • complete_dictionary
    • filtered_dictionary
    • keys
    • values
    • info
    • types
    key_lookup
    keys*
    delimiter,

    Dynamic Dictionary is ComfyUI's answer to "I have a pile of loose wires and I want them in one bag." You connect any number of inputs - strings, numbers, images, whatever - and it packs them into a single DICT you can pass around, filter, rename, and then unpack with the pack's Dictionary to Outputs node. It's the missing data-structure layer for a node graph that otherwise only speaks individual typed wires.

    What it does

    The node has no required inputs at all. You just start connecting things to its dynamic input sockets, and the UI grows more as you type in the string field - same pattern as Dynamic String Concatenate. Everything connected becomes a key-value pair: the input's name becomes the key, the value keeps its type.

    From there, the real power is in how it shapes the dict:

    • keys (default *) - filter which keys make it into the filtered_dictionary. A space- or comma-separated list, or * for everything.
    • key_lookup - rename keys in order. Leave empty to keep the original names; provide a list and the first key becomes the first new name, etc.
    • delimiter - only affects the info string output, which is a human-readable key: value dump (delimiter default ", ").

    Outputs: complete_dictionary (everything), filtered_dictionary (post-filter), keys (the key names joined as a string), values (the values as a list - or a single value if there's just one), info (the formatted dump), and types (the type names of each value).

    The details that matter

    Two behaviors are worth knowing before you build a workflow on it:

    • It flattens nested dictionaries. If you connect a DICT from another node, its inner keys are hoisted to the top level rather than kept nested - the source explicitly says "flattens incoming dictionaries to keep all values accessible." If you were relying on nesting, it's gone; if you want a flat key/value bag, that's exactly what you get.
    • It wraps values with type info. Each value is stored as {type, value}, so the types output and the info string can say "this is a float, this is a tensor" at a glance. Tensor and audio values get summarized in info as <image tensor 512x512> / <audio 12345 samples> rather than dumping raw data.

    One trap: values are keyed by input name, and duplicate names get suffixed (value, value2, …). So name your input wires meaningfully - width, height, seed - or you'll be decoding auto-generated keys later.

    The workflow shape

    The intended loop is Dynamic Dictionary → (filter, rename, inspect) → Dictionary to Outputs. You collect a set of settings or results into one DICT, pass it through a filter, and unpack the fields you need at the other end. It's the kind of node you don't need daily, but the day you need to bundle eight values into one wire and pass them through a single connection, nothing else does it.

    Install

    It's part of drmbt/comfyui-dreambait-nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/drmbt/comfyui-dreambait-nodes
    

    then restart ComfyUI (or ComfyUI Manager, search "comfyui-dreambait-nodes"). The pack installs its whole dependency list regardless - heavy ML deps included - though this node itself is pure Python. If you're already in the pack for Load Media or MiniCPM-V, it's free.

    Categoryutils

    Inputs (3)

    NameTypeDefaultDescription
    key_lookupoptSTRINGRename keys in order. Leave empty to keep original names.
    keysoptSTRING*List of keys to include, separated by spaces or commas. Use * or leave empty for all keys.
    delimiteroptSTRING, Character(s) to separate key-value pairs in info string.

    Outputs (6)

    NameTypeDescription
    complete_dictionaryDICT
    filtered_dictionaryDICT
    keysSTRING
    values*
    infoSTRING
    types*