07-11-2021 02:45 AM
Hi Experts,
I have a requirement where I need to check ‘group’ array is empty or not. Could someone help with the JSON path expression.
Empty group array JSON looks like:
[
{
“group”: [
{}
]
}
]
Non empty group array json loiks like:
[
{
“group”: [
{
“ID”: “002”
}
{
“ID”: “003”
}
]
}
]
Thanks in Advance.
07-12-2021 12:23 AM
Thanks a lot Bojan. instead if using ‘ID’ in json path expression is there any other way to check list is empty as the object ‘ID’ name is a dynamic one.
07-12-2021 12:25 AM
Yes @Gayathry , try this:
$group.filter(x=>x.keys().length != 0).length > 0
07-12-2021 12:46 AM
Thank you so much. It worked.