Check if the element in the array is empty or not

[
{
“test”: [
{
“group1”: “”,
“id”: 1
},
{
“group1”: “test”,
“id”: 2
}
]
}
]

How can i check if group1 is empty or not?

@nikola.k.popovski you could use a Find() which would return all the objects with group1.length==0, then see how many there are or process then ie $test.Find(data->data.group1.length==0)

Hi @nikola.k.popovski,

Since you have multiple objects in the test array, you’ll need to check every object separately. Mapping an additional field or replacing the object with a value that states if the group1 is empty is the way to go.

$test.map(x=>x.extend({"groupLength":x.group1.length})