Python Composite Class JSON Serialization

Try this:

def unpack_into_dict(object):
    res = {}
    for key, val in object.__dict__.items():
        if hasattr(val, '__dict__'):
            res[key] = unpack_into_dict(val)
        else:
            res[key] = val
    return res

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top