Help Desk

Submit a ticket My Tickets

How do I loop over a JSON Response?

When executing a OneCloud Command that returns a JSON response, there is often the need to loop over the Response and extract information for use across the Chain.  In this example, we explore iterating over a JSON response from an HTTP -> GET Request against a REST API.

Step 1: Supply a Sample JSON Response

After setting the REST API URL and any query parameters, a sample payload can be specified in the Response section.  The Response instructs OneCloud how to interpret the JSON response.  

Step 2: Enable Iteration

Often the need to iterate over a JSON response applies to multiple Commands and requires creating a Command Group.  Once the Command Group is created, edit it to enable Iteration and assign the JSON Response from a prior Command.

Command Group Editor

Step 3: Assign the Iteration Value

In the Command that needs each unique value from the Iteration loop, insert the relevant key from the JSON array to the parameter that needs to utilize it.

The iteration value may have an asterisks which indicates that a variable transformation has been applied.  In this instance, the value of the id key is being extracted and used to create the URL string that will be executed in a subsequent HTTP GET Request.  

Variable Transformation

Step 4: Review the Execution Logs

The result of the iteration can be reviewed in the Outputs-Inputs-Log panel, where each value of the iteration is accessible from the drop-down, and the iteration value is displayed.

If you need additional help, please feel free to post a response or contact us at

Learn More:

> How to use the CSV to JSON Command and iterate over the results?

  • When I attempt the variable conversion. I am not seeing the double quote " in the dropdown. Why would that be? I am using a json set returned suucessfully from CSV to JSON


  • Hi Mike,

    A recent update to the UI changed the icons.  Just select the T which means you will be parsing a text value.


  • Thanks Tony, I did as you suggest, but I am getting strange behavior. In the chain, I create a file from an input string, and attach a header and then convert the CSV to JSON, which I use to iterate running a chain. I do not get any failures, but the run chain step says it cannot continue due to an error. I do not see where the error is occurring. I added debug to email the csv file and then the json file. I get the csv, but the json is never sent.  Could it be because it is one column? Please advise.



  • I would log a ticket for this particular issue.  This will be tough to diagnose without seeing more details in the Chain execution and configuration. 

Login to post a comment