Nodes/ComfyUI-Apt_Preset/type_ListToArray
ComfyUI Node

type_ListToArray

Fold a real list back into a single array wire

By cardenluo·Created 2 years ago·Updated a day ago· 324
type_ListToArray
  • list
  • array

The return trip. type_ListToArray takes a true ComfyUI list - a socket carrying many items in parallel - and folds it into a single array wire holding one Python list. Where type_ArrayToList is the "unwrap" adapter, this is the "wrap it back up" one. It's what you reach for when some upstream node hands you a proper list but the rest of your pack-based graph wants to move it around as one object.

How it works

Its input is declared INPUT_IS_LIST = True, which tells ComfyUI the list socket expects multiple items (the list shape). The node gathers them and returns them as a LIST - the pack's array container, one wire, one Python list. Same data, different connection shape, exactly mirroring type_ArrayToList. Between the two of them, you can go back and forth between the pack's container convention and ComfyUI's native list convention at any point in the graph, which is genuinely useful because different nodes on your canvas will want different shapes.

When to reach for it

Three common cases. You've got a list output from a batch or iteration node and a pack utility (an array_Slice, an array_Merge) that only takes arrays - convert first. You want to carry a whole collection down a single wire through a flow_* stage without opening it up - wrap it. Or you're feeding a pack node that will re-expand it later and just needs one object to pass around. The one thing it won't do is merge multiple separate lists - each connected item becomes an element; if you have several arrays to join, that's array_Merge's job.

Install

It ships in ComfyUI-Apt_Preset: install via ComfyUI Manager (search "ComfyUI-Apt_Preset") or git clone https://github.com/cardenluo/ComfyUI-Apt_Preset into custom_nodes, run install.bat, restart. No models, no extra dependencies. The gotcha to remember is directional: if you feed it a single array expecting it to "expand" into a list, you've grabbed the wrong adapter - swap it for type_ArrayToList and the sockets will line up.

CategoryApt_Preset/data/list|Array

Inputs (1)

NameTypeDefaultDescription
list*

Outputs (1)

NameTypeDescription
arrayLIST