First of all, I\'m still a newb to python so please take it easy on me.
I\'ve done my research and I have a basic understanding of how to write a recursive function
def recurseDict(dictionary):
if "children" in dictionary:
return recurseDict(dictionary['children'])
else:
return "Whatever you want to return here -- you didn't specify"
This will take a dictionary, check if "children"
is one of its keys, then recurse through the dictionary dictionary['children']
and etc etc until it gets to a point where there isn't a 'children'
key (e.g. the dictionary has no further branches) where it goes into the else
branch and you can return whatever the heck you want -- you didn't specify.