I am dealing with JSON data sets with dynamic response structures (keys) and need to execute code if certain keys exist. Right now if the key doesn't exist it throws a key error which I have attempted to pass through a bool operand but it appears the key error trumps bool operands in Python.
bool(dictionary['key'])
KeyError: 'key'
I feel like there is some way to do this that's easier than I'm attempting but just haven't been able to find anything through researching. Any help would be greatly appreciated.