Skip to content

JSON Loop Close

Completes iterations of a JSON-based loop paired with JSON Loop Open. It evaluates a condition to decide whether to continue iterating or to finish and emit the final auxiliary values. When the loop is done (end of list or condition evaluates to false), it outputs FINISHED? = True along with the last aux states.
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. Feed any auxiliary state (aux, aux2–aux4) back into this node to preserve and update it across iterations. The Close node advances the index and re-triggers the next iteration until the list is exhausted or the condition evaluates to false.

Inputs

FieldRequiredTypeDescriptionExample
LOOPTrue*Loop state dictionary from JSON Loop Open. Required to continue or finalize the loop.
conditionTrueSTRINGExpression evaluated each cycle to decide whether to continue. Receives loop context including current_index, total_items, and any aux values.current_index < total_items and (aux is None or aux.get('continue', True))
auxFalse*Primary auxiliary data passed through each iteration. Use to carry and update state.{"count": 5}
aux2False*Additional auxiliary data slot.["processed", "skipped"]
aux3False*Additional auxiliary data slot.123
aux4False*Additional auxiliary data slot.true

Outputs

FieldTypeDescriptionExample
FINISHED?BOOLEANTrue when the loop has finished (end of list reached or condition evaluated to false).true
aux*Final value of the primary auxiliary data after the loop completes.{"count": 42}
aux2*Final value of aux2 after the loop completes.["item1", "item3"]
aux3*Final value of aux3 after the loop completes.987
aux4*Final value of aux4 after the loop completes.false

Important Notes

  • Must be paired with JSON Loop Open: Always connect the LOOP output from JSON Loop Open to this node's LOOP input.
  • No current item output: This node does not output the current JSON item; use JSON Loop Open's current_item for per-item processing.
  • Condition context: The condition can reference loop variables like current_index, total_items, and any aux values.
  • Iteration advance: On continue, the loop index automatically increments by 1 for the next item.
  • Finalization behavior: If the condition is invalid or evaluates to false, the node finalizes and outputs FINISHED? = True with the current aux values.
  • State persistence: To carry state across iterations, wire aux (and aux2–aux4 if needed) from JSON Loop Open through your processing chain back into this node.

Troubleshooting

  • Loop never ends: Ensure your condition eventually becomes false or that the JSON list is finite. Verify that aux state updates do not keep the condition permanently true.
  • FINISHED? never becomes True: Confirm the LOOP input is connected from JSON Loop Open and that the condition is a valid string expression.
  • Aux values are None at the end: Make sure aux/aux2–aux4 are connected through your processing nodes back into this node every iteration.
  • Condition errors: If the condition has syntax or name errors, the loop will finalize. Use only variables available in the loop context (e.g., current_index, total_items, aux).
  • Empty JSON list: An empty list finalizes immediately; FINISHED? will be True and aux outputs return their last provided values (possibly None).