Skip to content

JSON Loop Close

Completes and controls iteration for a JSON-based loop started by JSON Loop Open. It evaluates a condition each pass, advances to the next item in the JSON list, preserves auxiliary values across iterations, and outputs a FINISHED? flag when the loop ends or the condition fails.
Preview

Usage

Use this node together with JSON Loop Open to iterate over a JSON array. Connect the LOOP output from JSON Loop Open to this node's LOOP input. Wire any auxiliary state (aux, aux2–aux4) you want to preserve across iterations into both nodes. Optionally set a condition (as a string expression) to determine whether the loop should continue. When the loop completes (end of list or condition evaluates to False), FINISHED? outputs True and the latest auxiliary values are returned.

Inputs

FieldRequiredTypeDescriptionExample
LOOPTrue*Loop status dictionary from JSON Loop Open. Required to continue or finalize the loop.Connect from JSON Loop Open → LOOP
conditionTrueSTRINGString expression evaluated each pass to decide whether to continue iterating. Uses loop variables from LOOP and any provided aux values.index + 1 < total_items
auxFalse*Primary auxiliary data passed through each iteration and returned when finished.{"accumulator": []}
aux2False*Additional auxiliary data channel preserved across iterations.42
aux3False*Additional auxiliary data channel preserved across iterations.["status", "ok"]
aux4False*Additional auxiliary data channel preserved across iterations.null

Outputs

FieldTypeDescriptionExample
FINISHED?BOOLEANTrue when the loop has completed (end of list or condition evaluated to False).true
aux*Final value of the primary auxiliary data after the loop finishes.{"accumulator": [1,2,3]}
aux2*Final value of the second auxiliary channel.84
aux3*Final value of the third auxiliary channel.["status","done"]
aux4*Final value of the fourth auxiliary channel.null

Important Notes

  • You must connect the LOOP output of JSON Loop Open to this node’s LOOP input; otherwise the loop cannot proceed.
  • Condition is a string expression evaluated safely using loop variables from LOOP (e.g., index, total_items). If invalid or empty, it is treated as True by default on Open and evaluated on Close; an error on Close finalizes the loop.
  • This node advances the JSON index by 1 each iteration and preserves aux, aux2, aux3, and aux4 across passes.
  • On finalization (end of list or condition False), data outputs return the latest auxiliary values and FINISHED? = True.
  • Close node conditions cannot directly access current_item unless you store it in aux on the Open side or otherwise pass it along.

Troubleshooting

  • FINISHED? never becomes True: Ensure the condition eventually evaluates to False or that the list is not empty. Verify that the index is advancing (do not override index in Open each pass unless intended).
  • Condition errors immediately finalize the loop: Check the condition syntax and available variables (e.g., use 'index' and 'total_items' from LOOP).
  • Aux data not preserved between iterations: Make sure aux (and aux2–aux4) outputs from Open are connected to the matching aux inputs of Close, and vice versa, so values are forwarded each pass.
  • Loop does not start or stalls: Confirm that JSON Loop Open is receiving a valid JSON array and that its LOOP output is connected. If Open blocked due to invalid JSON, fix the json_list input.