Skip to main content

JSON array loops

A JSON array loop runs the same steps for each item in a JSON array, in order, one at a time. In this lesson, an API returns movie quotes. The Wrkflow processes the first ten available quotes, sends each quote to Launch Console, and sends one Done message after the loop exits.

Watch the walkthrough, then use the template and key settings below as you follow along.

Copy the demonstrated Wrkflow​

Click Copy template, open a Wrkflow in the Designer, and paste with Ctrl + V on Windows or Cmd + V on Mac.

Connect Start to Perform an API call and select your own The One API account connection before launching. Account credentials are not included. If you are new to API requests, start with Make an API call.

Key settings​

Wrk ActionSetting
Perform an API callUse GET with https://the-one-api.dev/v2/quote?limit=12. Capture Response body at $.docs as a Text (long) custom output named docs.
Loop through JSON arraySet JSON Array to Step 1 – docs. Set Maximum number of items to 10. Leave Start at last item? unset to process the list forwards.
Array loop's Custom OutputsAdd a Text (long) output named dialog. Select Item value as its source and enter $.dialog in JSON path.
Send to Launch Console inside the loopUse Info, with Notification Content set to Step 2 – dialog.
Continue loopSet Loop ID to Step 2 – Loop ID. Connect Continue back to the array loop, and set the array loop's Continue loop ID to Step 3 – Continue loop ID.
Final Send to Launch ConsoleConnect it to Exit. Use Info with the literal message Done.

The API field is spelled dialog, so the JSONPath is $.dialog. In Custom Outputs, this extracts the quote from the current item's object before passing it to the logger.

Check the result​

Save and launch the Wrkflow. With at least ten source items available, expect ten quote messages followed by one Done. Launch Console shows newer messages first; use timestamps to follow the execution order.

Troubleshooting​

  • Only one item: the return connection and both ID mappings.
  • Too many items: Maximum number of items is 10.
  • Empty quote messages: the dialog custom output uses Item value with $.dialog, and the logger references Step 2 – dialog.