Nodes/ComfyUI-TinyBee/Json Array To List
ComfyUI Node

Json Array To List

Turn a JSON array into a real list so for-each loops can chew on it

By TinyBeeman·Created about a year ago·Updated 10 days ago· 1
Json Array To List
    • list
    json[]

    There's a difference between "a string that happens to contain a JSON array" and "a list." A lot of tools in the ComfyUI ecosystem give you the first - an LLM reply, a file read, an API payload, a multiline string like ["dog", "cat", "bird"]. But ComfyUI's list iteration nodes (for-each loops, batch processors) want the second. Json Array To List is the bridge: you paste or pipe in a JSON array as text, it parses it, and it outputs each element as a genuine list of strings.

    That one-word change - "list" - is the whole trick. The output is marked OUTPUT_IS_LIST, so downstream nodes see a real batch of values and ComfyUI's loop machinery can iterate over it. It's the same shape of plumbing that makes list-based workflows readable: one node that turns a blob of text into something the graph can fan out over.

    What you'd use it for

    The realistic pipeline is LLM-powered: have a model return a JSON array of prompts, or filenames, or character names, then feed that output through this node and into a for-each that generates one image per entry. It also plays well with TinyBee's own list family - List Count, Random Entry, Indexed Entry, Randomize List - which all speak the same list language. And if your source is a file rather than a string node, Load String from File (same pack) gets you the raw text, and this node parses it.

    One detail people miss: every element comes out as a string. Numbers and booleans in the JSON get stringified (5"5", true"True" via Python's str()), so if you need actual ints downstream you'll be casting. For most text-driving use cases - prompts, names, paths - that's exactly right.

    The input and what can go wrong

    A single required json input: a STRING with a multiline text box, defaulting to []. Feed it valid JSON or don't - and the error messages are genuinely helpful. If the text isn't valid JSON you get a parse error naming the problem; if it parses but isn't an array (say it's an object {...}), you get [TinyBee] expected a JSON array, got dict. The fix in both cases is on you: make the upstream tool actually return an array.

    Install

    Standard TinyBee pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
    

    or ComfyUI Manager → "ComfyUI-TinyBee" → install → restart. No models, no GPU, no extra Python beyond the pack's light requirements.txt (pillow, jsonata). This is a pure stdlib json.loads under the hood, so there's no performance story - it's instant. It lives in the 🐝TinyBee/Lists category with the rest of the pack's list nodes.

    Category🐝TinyBee/Lists

    Inputs (1)

    NameTypeDefaultDescription
    jsonSTRING[]

    Outputs (1)

    NameTypeDescription
    listSTRING