items
Unfold a dict into key-value pairs — the round-trip enabler
- input_dict
- LIST
"items" turns a dictionary into a LIST of key-value pairs - each pair kept together as a (key, value) tuple. It's the pair-preserving deconstructor of the pack: get keys values splits keys and values into two parallel lists, but this keeps every key glued to its value. If you need to shuffle, sort, filter, or hand a dict's contents to a node that only speaks lists - and you want the key-value association to survive the trip - this is the node.
Keeping pairs together is the whole point. With two separate lists, reordering one without the other corrupts the data. With a list of tuples, each pair is a unit, so you can sort by key, by value, or reorder freely and the association never breaks.
How it works
input_dict(DICT) - the dictionary.- Output:
LIST- one tuple per entry,(key, value), in insertion order.
Under the hood it's list(dict.items()). Nothing destructive; the input dict is untouched.
Where it fits
- Round-trips: feed this output into
create from items (LIST), which rebuilds a dict from a list of pairs, and you have a lossless dict → LIST → dict loop. Perfect for passing dict data through nodes that can only manipulate lists. - Sorting: sort the pair list by key or by value with a sort node, then rebuild - sorted dicts, without losing pairing.
- Batch processing: fan the pairs out to per-item processing, then collect back into a dict.
A pairing detail
Because each tuple is (key, value), your pair-list is also a 2-column dataset in its own right: get item at index i, then index 0 for the key and 1 for the value. It's the most "self-describing" output of the deconstruct nodes, which is why it's the one people default to when they're not sure which splitter they need.
Gotchas
- The output is a LIST of tuples - don't expect a flat list of keys or values. If you need just one half,
keysorvalues(orget keys values) is the better tool. - Duplicate keys can't exist in the dict by definition, so round-tripping is always faithful - but rebuilding with
create from itemsdoes not re-validate types, so a value that was an int stays whatever it was.
Install
Part of Basic data handling - pure Python, zero dependencies, no model downloads. ComfyUI Manager → search "Basic data handling", or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
then restart ComfyUI. Small, but it's the hinge that lets dicts pass through list-only parts of your graph without losing themselves.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_dict | DICT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LIST | LIST | — |