JSON Loop
Use this step to loop over elements in an array, key/value pairs in an object, or all objects in a JSON value.
When the current flow point is inside the loop, and you open the variable containing the JSON you are looping over, the
Recorder View displays you the JSON you are looping over and the current element.
The JSON Loop step also belongs to the Loop category.
Properties
- Loop Over
-
The input JSON value.
For example, json or person.phoneNumbers.
- Loop Mode
-
In each iteration, the current JSON value is bound to a read-only variable that you need to define for the given loop mode. During iteration, it is not possible to change the value of the variable which you are looping over.
Select one of the following loop modes.
Loop mode
Description
Elements in array
Loops over elements in an array.
Optionally select Loop Backwards to loop over elements in reverse order.
Enter an Element Variable, such as element. This defines a local variable inside the JSON Loop step.
When looping over elements in the array, this variable appears in the State pane and contains the element value of the current iteration.
Key/value in object
Loops over key/value pairs in a JSON object.
Enter a Key Variable, such as key, and a Value Variable, such as value.
When looping over key/value pairs in an object, the two variables appear in the State pane and contain the key name and its value respectively.
All objects
Loops over all objects in a JSON structure.
Enter an Object Variable, such as object.
When looping over all objects in a JSON structure, this variable appears in the State pane and contains the object value of the current iteration. This loop mode traverses the given JSON variable in a depth-first order and loops over all objects in any depth.
- Iteration Variable
-
Optionally specify a variable to store iteration number.
See also Iteration variable.