def findkeys(node, kv):
if isinstance(node, list):
for i in node:
for x in findkeys(i, kv):
yield x
elif isinstance(node, dict):
if kv in node:
yield node[kv]
for j in node.values():
for x in findkeys(j, kv):
yield x

However, it can only find the special key's value, but cannot set the range (what I mean by range is that the first "

{}

" as array 0 + the second "

{}

" as array 1+ the "fields" in classLevelPermissions won't be involved in the result, in some sense I guess is the depth level ). I still cannot resolve the problem and get what I want.