01-12-2023 02:36 AM
[
{
“test”: [
{
“group1”: “”,
“id”: 1
},
{
“group1”: “test”,
“id”: 2
}
]
}
]
How can i check if group1 is empty or not?
01-12-2023 05:57 AM
@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)
01-12-2023 06:14 PM
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})