title: How to reiterate json response to extract a token and to make a restapi call with for-each activity
body: <p>i am using Copy Data activity(Can't use Web activity due to security reasons) to connect to Rest API(source) (via REST dataset)and I get a response in json format as shown below which is what i need, only that this is the first page and there are many other pages that i need to retrieve. The retrieved information is then saved in SQL database table (destination). In process to retrieve the next pages i need to extract the token from "continuationToken" and send it back to my REST dataset as an dynamic value. Not sure if this is the correct way but gave it a try.</p>
  
  <pre><code>[  
     {  
        "pagedResponse":[  
           {  
              "docType":"current",
              "orgNumber":"98789765",
              "persons":[  
  
              ],
              "clientId":43533,
              "name":null,
              "clientResponsible":{
                 "id":null,
                 "name":null
              }
           }
        ],
        "continuationToken":{  
           "token":"-RID:Om1+ANeDbNMWASEAAAAAAAAA==#RT:1#TRC:10#ISrV:2#IEO:6554436",
           "range":{  
              "min":"",
              "max":"05C1DFFFFFFFFFFC"
           }
        }
     }
  ]
  </code></pre>
  
  <p>I tried to run some test by saving the json response as a file. Created Lookup activity(Lookup1) to read in the json file and in the then created a for-each activity and in the items i  added a dynamic content 
  <code>@activity('Lookup1').output.value[0].continuationToken</code>
          but got this error message.:</p>
  
  <pre><code>{
      "errorCode": "InvalidTemplate",
      "message": "The function 'length' expects its parameter to be an 
       array or a string. The provided value is of type 'Object'.",
      "failureType": "UserError",
      "target": "ForEach1"
  }
  </code></pre>
  
  <p>expected result was:</p>
  
  <p><code>"token":"-RID:Om1+ANeDbNMWASEAAAAAAAAA==#RT:1#TRC:10#ISrV:2#IEO:6554436",
               "range":{"min":"","max":"05C1DFFFFFFFFFFC"}</code></p>