Skip to content

JSON Loop Open

Starts a loop over a JSON array and exposes the current item and a loop-state object. It evaluates an optional condition each iteration to determine whether to proceed, and passes through up to four auxiliary values that can be maintained across iterations.
Preview

Usage

Use this node to iterate over items in a JSON array. Provide the JSON in json_list and optionally a condition expression to gate execution per iteration. Connect the LOOP output to a JSON Loop Close node to advance the loop. Use current_item to process the current element, and aux/aux2/aux3/aux4 to carry state or additional data across iterations.

Inputs

FieldRequiredTypeDescriptionExample
json_listTrueSTRINGA JSON array to iterate over. Can be a JSON-encoded string (e.g., "[1, 2, 3]") or a list provided from an upstream node.["alpha", "beta", "gamma"]
conditionTrueSTRINGAn expression evaluated each iteration to decide whether to proceed. You can reference loop variables like current_item, current_index, items, total_items, finished, and any provided aux values.current_index < total_items and (aux is None or aux.get('enabled', True))
index_overrideFalseANYOverrides the current index for the iteration (0-based). Useful to start from a specific position or to resume.2
auxFalseANYPrimary auxiliary value passed through each iteration. Use it to carry state or context.{'running_sum': 15, 'enabled': True}
aux2FalseANYSecond auxiliary value passed through the loop.['tag1', 'tag2']
aux3FalseANYThird auxiliary value passed through the loop.session-123
aux4FalseANYFourth auxiliary value passed through the loop.0.75

Outputs

FieldTypeDescriptionExample
LOOPANYLoop-state object containing metadata for the iteration. Connect this to the LOOP input of a JSON Loop Close node to continue iterating.{'id': 102938, 'items': ['alpha', 'beta', 'gamma'], 'index': 1, 'finished': False, 'total_items': 3, 'last_id': 'node-uuid'}
current_itemANYThe current element from the JSON array for this iteration.beta
auxANYPass-through auxiliary value for state sharing across iterations.{'running_sum': 23}
aux2ANYSecond pass-through auxiliary value.['processed']
aux3ANYThird pass-through auxiliary value.session-123
aux4ANYFourth pass-through auxiliary value.0.9

Important Notes

  • Condition variables: The condition expression can reference current_item, current_index, items, index, total_items, finished, and any provided aux/aux2/aux3/aux4 values.
  • Pairing required: To advance the loop, connect the LOOP output to a JSON Loop Close node; that node triggers the next iteration.
  • Indexing: index_override is 0-based. If it is beyond the array length, the loop is considered finished.
  • Aux slots: Up to four auxiliary slots (aux through aux4) are available for carrying data/state across iterations.
  • Input format: json_list must represent an array. Non-array JSON (e.g., an object) will not iterate as expected.

Troubleshooting

  • Loop never starts: Ensure condition evaluates to True on the first iteration and that json_list is a valid array.
  • Invalid JSON: If json_list is a malformed JSON string, correct the format or provide a list from an upstream node.
  • Immediate finish: If index_override is greater than or equal to the number of items, the loop will be marked finished and current_item will be None.
  • No progression: Verify the LOOP output is connected to a JSON Loop Close node; without it, subsequent iterations won't execute.
  • Aux not updating: Confirm aux (and other aux slots) are wired through both Open and Close nodes and updated by the nodes in between as needed.