Nodes/ComfyUI_BadgerTools/StringToFizz-badger
ComfyUI Node

StringToFizz-badger

Turn a prompt list into machine-readable index-keyed text

By AbyssBadger0·Created 3 years ago·Updated 2 years ago· 8
StringToFizz-badger
    • STRING
    • INT
    text

    The "Fizz" in the name is the author's private format, and once you see it the node makes complete sense. StringToFizz-badger takes a multiline text - a list of prompts, captions, whatever - and rewrites it as index-keyed "key":"value" pairs. Line 1 becomes "0":"line one",, line 2 becomes "1":"line two",, and so on, with the trailing comma stripped off the last entry. You get back a string that looks like a JSON object body without the braces, plus the count of lines as a second output.

    The source is dead simple: split on newlines, skip empty lines, wrap each surviving line in quotes with its index, join, chop the last comma. That's the entire mechanism, and it's exactly the kind of thing a personal-toolbox author builds for their own automation and then publishes.

    The inputs and outputs are minimal:

    • text - a multiline STRING. One line per entry.
    • Output 1: STRING - the indexed Fizz text.
    • Output 2: INT - the number of non-empty lines.

    Use cases are the pragmatic end of automation. You've got a list of prompt variations and want to hand them to a script, an API, or a display node in a keyed form. You're building a workflow that iterates over entries - the INT output is a ready-made loop bound, so you don't have to count lines by hand. You're diffing prompt lists between runs, and the indexed format makes the comparison cleaner than raw newline text.

    The trap is the JSON one, and it's worth stating plainly: the output is not valid JSON. There's no opening or closing brace, and the node doesn't escape quotes inside your lines. Paste it into a strict JSON parser and it'll fail. If you need real JSON, wrap the output in braces yourself - and keep your lines free of double quotes. For non-empty lines only, too: blank lines vanish silently, so the INT count can disagree with what you thought you typed.

    For a node this specific, it's well-behaved: no model downloads, no API keys, nothing to configure. Install the pack the standard way -

    cd ComfyUI/custom_nodes
    git clone https://github.com/AbyssYuan0/ComfyUI_BadgerTools
    
    • or search ComfyUI_BadgerTools in ComfyUI Manager, restart, and it'll be under the badger category. If the whole thing feels like a niche utility for someone else's pipeline, you're not wrong. But the next time you need to shovel a prompt list into anything that wants keyed text, you'll be glad it's there.
    Categorybadger

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (2)

    NameTypeDescription
    STRINGSTRING
    INTINT