Hey everyone, I am doing an API call through my script and getting the response in an array. Each element in array contains some dictionary object. Its length is dynamic. Now I want to access this returned array from script file and use it in my event sheet. I tried using array object but could not find any solution. Here's my script:
async function apiCall(runtime) {
var resArray = [];
const data = {some data};
const res = await fetch(url, {
method: 'POST',
body: JSON.stringify(data),
headers:{
'Content-Type': 'application/json'
}
});
const result = await res.json();
console.log("Result: ");
resArray = result.res;
return resArray;
}
And the response I'm getting is this:
{
"res": [ { "price": "$0.05", "dots": [ 1, 0, 0, ]
},
{
"price": "$0.05",
"dots": [ 1, 0, 1, ]
},
],
}
How do I fetch this response inside my layout/event sheet as I want to use price & dots values of each element to render something on screen?