Skip to content

JSON Loop Close

Finalizes a JSON-based loop that iterates over items from a JSON array. Works together with JSON Loop Open: it checks the loop’s continuation condition, signals completion, and returns the final values of any auxiliary data passed through the loop. When the loop ends (end of array or condition not met), FINISHED? outputs True.
Preview

Usage

Use this node with JSON Loop Open to iterate over a JSON array. Connect the LOOP output from JSON Loop Open to this node’s LOOP input. Set the condition to control whether the loop continues. Pass any auxiliary data (aux, aux2, aux3, aux4) through both nodes to maintain and retrieve state across iterations. Monitor FINISHED? to know when the loop has completed and then use the aux outputs for the final aggregated or updated values.

Inputs

FieldRequiredTypeDescriptionExample
LOOPTrueANYLoop context from JSON Loop Open. This establishes the linkage and state for the JSON iteration.Connect from JSON Loop Open → LOOP
conditionTrueSTRINGExpression that determines if the loop should continue. If it evaluates to False, the loop ends and FINISHED? becomes True.True
auxFalseANYPrimary auxiliary data passed through each iteration. Use it to carry and update state across the loop.{"count": 3}
aux2FalseANYSecondary auxiliary data slot for additional state or payloads.["accumulated", "values"]
aux3FalseANYTertiary auxiliary data slot for additional state or payloads.42
aux4FalseANYQuaternary auxiliary data slot for additional state or payloads.null

Outputs

FieldTypeDescriptionExample
FINISHED?BOOLEANTrue when the loop has completed (array fully processed or condition evaluated to False).true
auxANYFinal value of the primary auxiliary data after the loop completes.{"count": 10}
aux2ANYFinal value of the secondary auxiliary data after completion.["a", "b", "c"]
aux3ANYFinal value of the tertiary auxiliary data after completion.84
aux4ANYFinal value of the quaternary auxiliary data after completion.null

Important Notes

  • Condition controls continuation. If it evaluates to False, the loop stops and FINISHED? becomes True.
  • Connect this node’s LOOP input to the LOOP output of JSON Loop Open. Without this connection, the node cannot operate.
  • Aux inputs (aux–aux4) are optional passthroughs for maintaining state; their final values are emitted when the loop ends.
  • An empty condition is treated as True.
  • Hidden inputs are system-managed and typically should not be modified.

Troubleshooting

  • FINISHED? never becomes True: Ensure your condition will eventually evaluate to False or that the JSON array is non-empty and iterates to completion.
  • Aux outputs are None: Verify that you wired aux/aux2/aux3/aux4 into both JSON Loop Open and JSON Loop Close throughout your loop.
  • Loop stops immediately: Check the condition expression; if it evaluates to False on the first check, the loop will complete right away.
  • Error about creating the JSON loop system: Update your Salt environment to the latest version to ensure loop orchestration features are supported.
  • Unexpected condition behavior: Ensure any variables used in the condition are available from the loop context or provided as aux inputs.