Given an output like this one below, which is obtained to a graph-api call.
"value": [
{
"userPrincipalName": "user@doamin.com",
"assignedLicenses": [
{
"disabledPlans": [],
"skuId": "4b585984-651b-448a-9e53-3b10f069cf7f"
},
{
"disabledPlans": [],
"skuId": "26d45bd9-adf1-46cd-a9e1-51e9a5524128"
}
]
},
[....]
I would to count the ocurrences for an skuId (4b585984-651b-448a-9e53-3b10f069cf7f) for example.
I tried splitting the by the string, and counting with no luck.
sub(length(split('@outputs','4b585984-651b-448a-9e53-3b10f069cf7f')),1)
Unfortunately, the build in functions do not allow conditional parsing of the arrays for counts. But this can be achieved by a simple manipulation via filter array.
Here's how you can do it. Remember to parse the value object only. In case you have multiple objects, consider using a join t merge the license arrays first before filtering by skuid