I have a query object for which filter looks like -
"filter": {
"type": "and",
"fields": [
{
"type": "selector",
"dimension": "loyalty parent attribute",
"value": "Most Active Communicator"
},
{
"type": "and",
"fields": [
{
"type": "and",
"fields": []
},
{
"type": "and",
"fields": [
{
"type": "and",
"fields": [
{
"type": "not",
"field": {
"type": "in",
"dimension": "corporation",
"values": [
null
]
}
}
]
}
]
}
]
}
]
}
As we can see this JSON can very quickly take a very complex form with a few filters. But this is system driven so I can hardly do anything about it. Due to a certain operation, an empty array called fields appears as we can see in the third and operation. Currently, I have written a very hardcoded way to find those empty fields arrays and remove such items. Looking more a more robust way to do this.