Is there a clever way to check if any array in a json element is not empty? Here is example data:
{
a = []
b = []
c = [1,2,3]
}
>Solution :
You can use any(), returning True if any of the values in the JSON object are truthy:
data = {
'a': [],
'b': [],
'c': [1,2,3]
}
result = any(item for item in data.values())
print(result)
This outputs:
True