Mie Loop Collect JSON ๐
Gather a structured record per loop pass
- loop_ctx
- loop_ctx
When each loop pass produces structured data - not just a string, but a little record with fields - MieLoopCollectJSON is the node that gathers those records into a list. Each iteration appends one JSON object to the loop context, and at the end MieLoopFinalizeJSONList hands you the whole array.
Part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, under the ๐ Loop submenu.
Why you'd reach for it
Text collection is fine when each pass yields one line, but a lot of the time a pass produces several things you want to keep together: the prompt, the seed, the score, the filename, the settings that produced this result. Stuffing that into a flat string and re-parsing later is a pain. Collect it as JSON instead - one object per iteration with named fields - and you get a clean array you can process, save, or feed back into another workflow. It's the node for building a structured log or a manifest out of a loop.
The inputs and outputs that matter
loop_ctx(MIE_LOOP_CTX) - the loop context.item_json(STRING, multiline, default{}) - this iteration's record, as a JSON object. Build it from the pass's values - e.g.{"index": 0, "prompt": "...", "seed": 12345}. The multiline field gives you room to compose it.- Output
loop_ctx- the context with this object appended, passed onward.
The one thing to get right is that item_json has to be valid JSON. It's a string field, so it's on you to make sure the braces, quotes, and commas are correct - often you'll assemble it from other nodes' outputs rather than typing it by hand.
Installing it
ComfyUI Manager โ search ComfyUI-MieNodes โ install โ restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
then restart. No model downloads or heavy dependencies. Under ๐ MieNodes โ ๐ Loop.
Common issues
Malformed JSON. This is the big one. item_json must parse - unescaped quotes, trailing commas, or single quotes instead of double will break it. If you're building the object from string concatenation, double-check the result is genuinely valid JSON before it hits this node.
Empty objects piling up. The default is {}. If a pass doesn't populate item_json, you collect an empty record. Make sure each iteration writes the fields you actually want.
I only have a plain string per pass. Then you don't need JSON - MieLoopCollectText is simpler and won't make you worry about escaping. Reach for JSON only when you genuinely have structured, multi-field records to keep.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ | |
| item_json | STRING | {} | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ |