Nodes/ComfyUI-JDCN/JDCN_StringToList
ComfyUI Node

JDCN_StringToList

Multiline text to a real list, the two-second way

By daxcayΒ·Created 2 years agoΒ·Updated about a year agoΒ· 160
JDCN_StringToList
    • list
    β—„stringβ€”β–Ί

    JDCN_StringToList takes one big block of text and splits it into an actual list of strings, one item per line. That's the entire job, and it's the job half your ComfyUI graphs quietly need.

    Here's the situation that makes it useful: a lot of nodes - JDCN's own AnyFileList, BatchImageLoadFromList, and half the "list of things" utilities in other packs - want a list as input, not a text blob. But you often have your data as text: a notepad file of prompts, a pile of file paths, a comma list you pasted in. This node is the bridge. It's also the inverse of the pack's ListToString sibling: one flattens lists into multiline text, the other turns that text back into a list.

    How it works

    Mechanically it's one line: the input string is split on newline characters and each line becomes an element of the output list. The string input is a standard STRING field with force-input, so you can type directly in the widget or wire a text output from somewhere else into it. The single output, list, is a list of strings (STRING list type).

    One gotcha from that mechanism: a trailing newline or an empty line produces an empty-string element in your list. Paste a prompt file with a blank line at the end and you'll suddenly be processing ["prompt one", "prompt two", ""] - harmless for some consumers, confusing for others. Trim your input or filter empties downstream.

    It's marked as an output node, so ComfyUI treats it as a terminal/sink - but you can still wire the list output onward into any node that accepts a string list, which is the point.

    When you'd actually reach for it

    • You have a .txt file of prompts or negative prompts and want to iterate them per queue run.
    • A file list node gave you paths as text and a downstream loader wants a list.
    • You're feeding a ReBatch-style node and need clean list input.

    It's tiny, it's fast, and it has no hidden state. Not glamorous, but it removes a class of "expected a list, got a string" errors that eat beginner afternoons.

    Installing it

    It ships in the ComfyUI-JDCN pack. The easiest route:

    1. Open ComfyUI Manager β†’ Install Custom Node.
    2. Search for JDCN and install ComfyUI-JDCN.
    3. Restart ComfyUI. Done.

    Manual, if you prefer:

    cd ComfyUI/custom_nodes
    git clone https://github.com/daxcay/ComfyUI-JDCN.git
    cd ComfyUI-JDCN
    pip install -r requirements.txt
    

    Restart ComfyUI and the node appears under the πŸ”΅ JDCN πŸ”΅ category. The only Python dependency the pack lists is piexif - no models to download, nothing heavy. It's also on the Comfy registry, so comfy node registry-install comfyui-jdcn works with comfy-cli.

    Common issues

    Beyond the trailing-newline quirk, the main one is wiring: the node expects text, so feeding it a string list from another node won't behave the way you expect (you'll get the repr of the whole list). Keep it pointed at plain multiline text and you're fine. If you're on this page because a workflow loaded but the node is red, check that you installed the pack and restarted - that's the fix nine times out of ten with any custom node.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRINGβ€”

    Outputs (1)

    NameTypeDescription
    listSTRINGβ€”