Nodes/ComfyUI-JDCN/JDCN_ListToString
ComfyUI Node

JDCN_ListToString

Turn a list of strings into one block of text

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

    ComfyUI hands you lists of strings all over the place - file paths from a folder scanner, a batch of prompts, tags coming out of a text-splitter - and then a surprising number of nodes want one single text blob instead of a list. JDCN_ListToString is the bridge: one input, one output, it joins every item in the list into a single multi-line string. That's the whole node. It's the kind of thing that looks trivial until you're wiring a batch of file names into a display node and realize nothing in core will glue them together for you.

    How it works

    The input is declared with forceInput, and the node sets INPUT_IS_LIST = True, which is the important bit: it expects a real list wire, not a single value. When the queue runs, every item in that list gets joined with a newline, producing one string that reads like a plain text list:

    render_001.png
    render_002.png
    render_003.png
    

    The output string is what you feed onward. Because it's OUTPUT_NODE = True, it'll also show up as a text display in the node itself, which makes it handy for eyeballing what a folder scan actually returned before you commit it to anything.

    Where it fits

    The classic pairing is with the JDCN file-list nodes: JDCN_AnyFileList gives you a list of paths, this node turns it into a readable block, and then JDCN_TXTFileSaver (same pack) writes that block to a .txt file. You've just exported your folder's contents to disk in three nodes. The reverse direction is JDCN_StringToList - split one text block back into a list - so the pair acts as a text-list shuttle.

    Install

    This node is part of the ComfyUI-JDCN pack. Through ComfyUI Manager: Install Custom Nodes β†’ search "JDCN". Or manually:

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

    The whole pack's only dependency is piexif (plus psutil which ComfyUI already ships). No models to download.

    Gotchas

    • Empty input - if the list is empty, the node prints Error in List Variable to the console and returns an empty string. It won't crash the run, but you'll wonder where your text went.
    • It needs a list - don't feed it a plain STRING value and expect magic. A single string usually arrives as a one-element list, which works, but if you're getting one giant line of joined-together words, the wire feeding it isn't a list and ComfyUI is mangling the type.
    • Newlines only - there's no separator option. It's newline-joined, full stop. If you need commas or pipes, that's what JDCN_StringManipulator in the same pack is for.

    Honest assessment: it's a two-line node and nobody's pretending otherwise. But it sits in the middle of enough file-handling workflows that having it around saves you from hand-typing path lists or reaching for a Python expression node every single time.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (1)

    NameTypeDefaultDescription
    listSTRINGβ€”

    Outputs (1)

    NameTypeDescription
    stringSTRINGβ€”