I have a json string and I want to know what its maximum depth is. By depth I mean the number of embedded keys. So if one key as 7 \"children\" and know other key had that
def depth(d): if hasattr(d, "values"): return 1 + max(map(depth, d.values())) if hasattr(d, "__len__") and not hasattr(d, "lower"): return 1 + max(map(depth, d)) return 0