objeto aninhado de python para ditar
def my_dict(obj):
if not hasattr(obj,"__dict__"):
return obj
result = {}
for key, val in obj.__dict__.items():
if key.startswith("_"):
continue
element = []
if isinstance(val, list):
for item in val:
element.append(my_dict(item))
else:
element = my_dict(val)
result[key] = element
return result
Vivacious Vendace