NS Structured Prompt List
Turn an LLM's JSON Into a Fan-Out Workflow
- prompts
- filename_prefixes
- count
Ask an LLM for "a list of 8 prompts" and you get prose, half the time with a ```json fence around it and an apology about the other 7. NS Structured Prompt List exists to take that mess and turn it into something ComfyUI can actually iterate over: it parses a JSON string, pulls out an array, and emits two parallel STRING lists - one of prompts, one of filename prefixes - so the downstream graph runs once per item instead of once per all-of-them.
This is the node that makes "LLM plans the batch, ComfyUI renders it" real. The LLM decides the variety - 12 angles on the same subject, a grid of styles - and the fan-out does the mechanical work. If you've ever built an iterate-by-count loop and hated it, this is the cleaner pattern.
How it works
Give it a JSON string like:
{"items": [
{"prompt": "product shot, matte black", "filename_prefix": "black_01"},
{"prompt": "product shot, brushed steel", "filename_prefix": "steel_02"}
]}
The node walks items_path (default items) into the array, then reads prompt_field (prompt) and filename_field (filename_prefix) from each item. If the upstream LLM wrapped its output in ```json fences, they're stripped automatically. The two lists come out index-aligned, so prompt #2 always pairs with filename #2 - wire them into a fan-out and each render saves under its own prefix. A count INT comes along so you can gate logic on how many items arrived.
The path and field names are all widgets, so it's generic: rename the fields to match whatever schema your LLM was told to emit and it just works. Malformed JSON, a missing key, or a wrong path raises a clear error naming the available keys - no silent empty batch.
Inputs and outputs
Required: json_string, items_path, prompt_field, filename_field. Outputs: prompts (STRING list), filename_prefixes (STRING list), count (INT).
Install and setup
Part of the Symbiotica pack. ComfyUI Manager → search "Symbiotica", or:
cd ComfyUI/custom_nodes
git clone https://github.com/symbiotica-ai/comfyui-nodes.git symbiotica
pip install -r symbiotica/requirements.txt
Restart. No key, no model - pure parsing glue. It pairs naturally with this pack's LLM chat nodes and its fan-out-friendly save nodes.
Troubleshooting
- "Key 'x' not found" - the error lists what keys are available. Your LLM changed its output schema mid-run; update
prompt_field/filename_field(or the LLM's instructions) to match. - Nothing comes out despite valid-looking JSON - check
items_path. Defaultitemsmatches{"items": [...]}; leave it empty if the JSON root is the array. Both are valid - the path just has to describe your shape. - The downstream ran once with the whole list - the
prompts/filename_prefixesoutputs are lists; you have to wire them into a node that fans out (list inputs iterate). Connecting to a plain string input collapses them. - Code fences still in the output - they're stripped when the fences wrap the whole JSON. If the LLM embedded the array inside prose, the node can't rescue that; ask the LLM for bare JSON.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| json_string | STRING | — | |
| items_path | STRING | items | — |
| prompt_field | STRING | prompt | — |
| filename_field | STRING | filename_prefix | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| prompts | STRING | — |
| filename_prefixes | STRING | — |
| count | INT | — |