I'm trying to create a recursive function that takes a JSON dictionary and stores any value with key names 'rate' into a list. I will then take that list and find the lowest value. My code looks like this right now, but is producing multiple empty lists within the list.
def recurse_keys(df):
rates = []
for key, value in df.items():
if key == 'rate':
rates.append(value)
if isinstance(df[key], dict):
recurse_keys(df[key])