I am currently doing something like this to access an array in my json object
teacher_topical_array = teacher_obj["medication"]["topical"]
However before doing that I would like to make sure the path teacher_obj["medication"]["topical"]
exists and I am looking for a simpler approach to accomplish this.
Now I understand I could do something like this
if "medication" in teacher_obj:
if "topical" in teacher_obj["medication"]:
#yes the key exists
I wanted to know if I could accomplish the above in a different way. That might be more effective if I had to check for something like
teacher_obj["medication"]["topical"]["anotherkey"]["someOtherKey"]