I have a JSON object in Python represented as a nested lists of dictionaries. (Some of the values of the dictionary are dictionaries themselves, and so on.)
I want to be able to search for a key on all branches of this nested dictionary structure.
When I find the key I want to be able to return the full key path that leads to it.
For example: I'm looking for "special agents" who have a "special address key", but not all special agents have it, and those that do have it in inconsistent paths in their JSON.
So I search for key Special Address code
.
The result should return:
/'People'/'SpecialAgents'/'007'/'Special Address code'/
So I will be able to reach its information in that way:
json_obj['People']['SpecialAgents']['007']['Special Address code']
Note that this is similar to this question but I need the full path to each instance of the key found.