I'm trying to loop over a dictionary with nested keys to see if they're identical or not. If they are not (IE, false) I need to trigger separate logic in my program.
I've pasted an example of the dictionary/JSON where I'm looking to check if the nested key_of_interest are all the same. In this case, they are false (abc
vs def
)
[{'name': 'set-1',
'name': [{'name': 'rule-1',
'outer_key': {'key_of_interest': {'secondary_key': [None]}}},
{'name': 'rule-2',
'outer_key': {'key_of_interest': [None]}}]}]
I've tried various combinations of if all
without success... any guidance would be appreciated.
Thanks! Edit: Reason why 'Elegant way to check if a nested key exists in a python dict' doesn't apply is discussed below