Nodes/ComfyUI-Kie-API-Serverless/KIE Parse Prompt Grid JSON (1..9) [SL]
ComfyUI Node

KIE Parse Prompt Grid JSON (1..9) [SL]

Turn an LLM's prompt JSON into nine wires

By v3devv·Created 7 months ago·Updated 4 months ago· 0
KIE Parse Prompt Grid JSON (1..9) [SL]
    • prompt 1
    • prompt 2
    • prompt 3
    • prompt 4
    • prompt 5
    • prompt 6
    • prompt 7
    • prompt 8
    • prompt 9
    • count
    • prompts_list
    • prompts_list_seq
    json_text
    default_prompt
    max_items9
    strictfalse
    debugfalse

    The dumbest-looking node in this pack and one of the most useful. You ask an LLM for "nine prompts for a 3x3 grid," it hands you a JSON blob, and this node un-jams that blob into nine separate string outputs plus a count. No API, no key, no credits - it's a pure local JSON parser with very forgiving taste in JSON.

    Why it exists: the natural way to batch a grid generation is to let an LLM write all nine prompts at once, then feed them to a Nano Banana Pro or Seedream call per cell. The glue between "LLM says yes" and "nine cells filled" is exactly this node. It's the sibling of GridSlice in the pack's story - one call, many cells - just working on text instead of pixels.

    The inputs that matter

    • json_text - the raw LLM output. It's force-input, so it wants a wire from a text node, not a typed value.
    • default_prompt - fallback if parsing yields nothing. Set this and a broken LLM response degrades to "fill every cell with this prompt" instead of killing the run.
    • max_items - cap at 1–9, default 9.
    • strict - default off. Flip it on and any parse failure raises instead of falling back.
    • debug - prints what it saw to the console. Turn this on the first time and thank it later.

    Outputs: prompt 1 through prompt 9 (empty strings for missing cells), plus count (INT), prompts_list (a STRING list for automation), and prompts_list_seq (a proper list output).

    What JSON it actually accepts

    Generously, is the answer. It handles a plain array of prompt strings, or an object with a prompts array, or keyed objects like prompt1/prompt_1/p1/numeric keys (sorted by index). It strips code fences around the JSON, and if the LLM buried the JSON in prose, it extracts the first {...} or [...] blob it finds. The one thing it can't do is read the LLM's mind when the model returns plain prose with no JSON inside - then you get the "No prompts found in json_text" error, or the default_prompt fallback if you set one.

    Install

    Same as the rest of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/v3devv/ComfyUI-Kie-API-Serverless
    

    or Manager search "Kie-API-Serverless", restart. No dependencies beyond what ComfyUI ships.

    The one trap

    Don't forget the prompts_list output for long runs. Once you exceed the 9 named wires, that list output (plus count) is what you'd loop over for bigger grids. And in the "grid + LLM + API" loop, remember the model's JSON quality is the actual bottleneck - a strict-schema request to your LLM (this pack's Gemini node supports response_format_json for exactly this) saves you a world of parser-fallback pain.

    Categorykie-sl/helpers

    Inputs (5)

    NameTypeDefaultDescription
    json_textSTRING
    default_promptoptSTRING
    max_itemsoptINT91–9
    strictoptBOOLEANfalse
    debugoptBOOLEANfalse

    Outputs (12)

    NameTypeDescription
    prompt 1STRING
    prompt 2STRING
    prompt 3STRING
    prompt 4STRING
    prompt 5STRING
    prompt 6STRING
    prompt 7STRING
    prompt 8STRING
    prompt 9STRING
    countINT
    prompts_listSTRING
    prompts_list_seqSTRING