ComfyUI Node

Get Nested Dict

Pull a dict out of another dict

By antrobot1234·Created 3 years ago·Updated about a year ago· 28
Get Nested Dict
  • DICT
  • default
  • Default
key

Get Nested Dict pulls a DICT back out of another DICT. Yes, dicts inside dicts - that's the point. It lets you organize the bag hierarchically: a top-level dict whose entries are themselves dicts, so you can group related values ("sampler_settings", "image_stuff", "flags") under one key each and fetch a whole group at once. This is the node that reaches into the outer bag and hands you an inner one.

Nesting is worth it once a flat dict gets crowded. If you're stashing a dozen loose values, retrieving them one by one is tedious and collision-prone. Group them into sub-dicts with Set Dict, nest those under named keys, and now a branch that needs "everything about the refiner pass" fetches one nested dict and unpacks locally. It's the dict system's answer to structure, the same way folders beat a hundred loose files.

How it works

It's a typed Get Dict, so per the README it behaves like the plain Get Dict with two upgrades: the default is optional (omit it and you get the type's standard default), and the value is type-validated - if the key holds something that isn't a dict, you get the default instead of a broken object. Fetch the inner dict, then run it into further Get Dict nodes to reach the actual values inside.

The inputs and outputs that matter

  • key (required, text) - the name the inner dict was stored under. Match it exactly.
  • DICT (required) - the outer bag you're reaching into.
  • default (optional) - a DICT to fall back on if the key is missing or isn't a dict.

One output - and here's a small quirk to know: it's labeled Default (capital D) rather than "DICT". Cosmetic naming oddity, nothing more; it still emits the retrieved (or fallback) dict. Wire it into your next Get Dict nodes.

Installing it

Lightweight pure-Python pack, no model downloads. ComfyUI Manager → Install Custom Nodes → search "antrobots ComfyUI Nodepack" → Install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/antrobot1234/antrobots-comfyUI-nodepack

then restart. It's under antrobots-ComfyUI-nodepack/dicts/get.

Common issues

Nesting multiplies the ways a key mismatch hides. A typo at either level - outer key or inner key - silently returns a default, and now you're debugging two lookups instead of one. Keep your grouping keys short and consistent, and when a nested value goes missing, walk it outer-first: confirm the inner dict comes out here before blaming the value-level Get node downstream.

If you didn't supply a default and the key isn't found, the fallback dict is effectively empty, so every Get Dict you run against it will itself fall back to its defaults - a cascade of quiet defaults that looks like "nothing works." Providing a sensible default, or guaranteeing the key exists, saves you that hunt. It's a solo pack; real bugs are a GitHub issue away, which the author asks for.

Categoryantrobots-ComfyUI-nodepack/dicts/get

Inputs (3)

NameTypeDefaultDescription
keySTRING
DICTDICT
defaultoptDICT

Outputs (1)

NameTypeDescription
DefaultDICT