Using the following to produce asset data from all items within a folder - which is great and working as expected. I am then continuing down the tree to also try and get asset data from the grandchildren, but at the moment only getting asset ID.
const children = %globals_asset_children:12345^json_decode^as_asset:asset_data%;
const grandChildren = %globals_asset_children:12345^as_asset:asset_children,asset_children%;
children.forEach(function(child, i) {
return(' + child + ');
if (grandChildren[i].length > 0) {
grandChildren[i].forEach(function(grandChild) {
return(' + grandChild + ');
});
}
});
const showResults = [...children, ...grandChildren];
print(JSON.stringify(showResults, null, 2));
I am wanting to take the assets returned from grandChildren and then use these to obtain the asset data, metadata, etc.
Something like:
const grandChildrenData = %globals_asset_children:["2222", "3333", "4444"]^json_decode^as_asset:asset_data%;
Where [“2222”, “3333”, “4444”] are actually the asset IDs returned from grandChildren.
Is there a way where you can retrieve the information back from Squiz, without having to create a new variable for every asset which contains children?
Thank you