I can't for the life of me figure out how to loop over the following json snippet to retrieve the resource_id value to produce the following list {1, 2, 3}.
var dataStringify =
{
"items": [
{
"events": [
{
"parameters": [
{
"name": "resource_id",
"value": "1"
}
]
}
]
},
{
"events": [
{
"parameters": [
{
"name": "resource_id",
"value": "2"
}
]
}
]
},
{
"events": [
{
"parameters": [
{
"name": "resource_id",
"value": "3"
}
]
}
]
}
]
}
I have gotten as far as logging the following to determine that iterating on items with the following dot notation would yield approximately what I need, but I can't seem to be able write a working loop.
Logger.log(dataStringify.items[0].events[0].parameters[1].value);
this yields just the first value "1" rather than a list {1,2,3}