If the API response is an array then you will have to use proper formatting to print the objects of the array.
For example:
If context.<servicenode>.response.body.queryResult – with queryResult being part of the response body has the relevant data which is an array then you may use script as below:
var data= context.<servicenode>.response.body.queryResult;
if (data.length>1)
{
var data= context.<servicenode>.response.body.queryResult;
for(var i=0;i<data.length;i++){
var currentItem = {};
CurrentItem = {
Name: data[i].PersonName ,
SSN: data[i].SSN ,
Phone: data[i].Phone,
Email: data[i].Email
}
context.session.BotUserSession.queryResult.push(CurrentItem)
}
}
And when printing the data, use for loop to print data from context.session.BotUserSession.queryResult[i]
This is simply one of the ways to handle the response. You may use other scripting logics per your choice. Hope this helps