KIE Parse Prompt Grid JSON (1..9)
Splitting an LLM's 9-prompt JSON into individual wires
- prompt 1
- prompt 2
- prompt 3
- prompt 4
- prompt 5
- prompt 6
- prompt 7
- prompt 8
- prompt 9
- count
- prompts_list
- prompts_list_seq
The pack's grid workflow - the one that made it famous - goes like this: an LLM looks at your input image and generates a set of prompt variations, those prompts each become a cell in a 2×2 or 3×3 Nano Banana Pro grid, and the grid gets sliced into individual images for downstream video. The missing link is the step where one JSON blob from the LLM becomes nine separate prompts that can each feed its own generation node. That's this node's entire job.
KIEParsePromptGridJSON takes a JSON string (from any upstream node that emits one) and splits it into up to nine STRING outputs. It's a parsing utility, not a generator - nothing leaves your machine, no API calls, no credits. You could hand-roll the same logic in a Python script, but this is the node that makes the grid workflow buildable in pure graph form.
How it works
Feed it JSON in any of the shapes the parser accepts - an array of prompt strings, an object with a prompts array, or an object with keyed prompts like p1, prompt2, and even bare string keys like "4" and "Prompt 3". It flattens what it finds into ordered prompts and exposes each on its own output, up to max_items (default 9, max 9).
Two behavioral notes worth knowing:
json_textmust be wired. This input is markedforceInputin the node definition - there's no manual text box. You have to connect it to something that emits a STRING, like an LLM node. If you're staring at an emptyjson_textwith no way to type into it, that's by design, not a bug.- Empty slots stay connected. Prompts 1–9 all exist as outputs regardless of how many the JSON actually contained; missing ones are empty strings. Downstream nodes won't error on an empty input, they'll just get "". That's how a 2×2 grid works without rewiring anything.
Inputs that matter
- json_text (required, wired) - the LLM output to parse.
- default_prompt - fallback used when parsing yields nothing (unless
strictis on). - max_items - cap between 1 and 9; leave at 9 unless you're intentionally feeding fewer cells.
- strict - fail hard on parse errors or missing prompts instead of silently falling back. Turn it on in production, off while you're debugging an LLM that occasionally returns garbage.
- debug - extra parser diagnostics in the console.
Outputs
Nine prompt 1…prompt 9 STRING outputs, plus count (how many were parsed), prompts_list (the raw list, for automation), and prompts_list_seq (a sequence-friendly version). For a standard grid, you only touch the prompt N outputs.
Install
Manager (search "ComfyUI-Kie-API") or:
cd ComfyUI/custom_nodes
git clone https://github.com/gateway/ComfyUI-Kie-API
Restart. No API key needed for this node - it's a pure helper - though the pack as a whole wants one for the generation side.
The gotcha that catches people
The most common "it's not working" here is a parser-shaped JSON. If your LLM wraps the prompts in a structure the node doesn't know - say, {"results": {"items": [...]}} - it won't find them, and you'll get count 0 and empty prompts (or a strict-mode error). Check the actual LLM output format against the accepted shapes (array, prompts array, or keyed prompts) and adjust your LLM's system prompt to emit one of them. The pack's own KIE_SystemPrompt_Selector exists partly so you can standardize that system prompt.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| json_text | STRING | — | |
| default_promptopt | STRING | — | |
| max_itemsopt | INT | 91–9 | — |
| strictopt | BOOLEAN | false | — |
| debugopt | BOOLEAN | false | — |
Outputs (12)
| Name | Type | Description |
|---|---|---|
| prompt 1 | STRING | — |
| prompt 2 | STRING | — |
| prompt 3 | STRING | — |
| prompt 4 | STRING | — |
| prompt 5 | STRING | — |
| prompt 6 | STRING | — |
| prompt 7 | STRING | — |
| prompt 8 | STRING | — |
| prompt 9 | STRING | — |
| count | INT | — |
| prompts_list | STRING | — |
| prompts_list_seq | STRING | — |