Nodes/ComfyUI_MieNodes/Mie Loop Collect JSON ๐Ÿ‘
ComfyUI Node

Mie Loop Collect JSON ๐Ÿ‘

Gather a structured record per loop pass

By MieMieeeeeยทCreated 2 years agoยทUpdated 28 days agoยท 225
Mie Loop Collect JSON ๐Ÿ‘
  • loop_ctx
  • loop_ctx
โ—„item_json{}โ–บ

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.

Category๐Ÿ‘ MieNodes/๐Ÿ‘ Loop

Inputs (2)

NameTypeDefaultDescription
loop_ctxMIE_LOOP_CTXโ€”
item_jsonSTRING{}โ€”

Outputs (1)

NameTypeDescription
loop_ctxMIE_LOOP_CTXโ€”