I've tried to convert a thrift object to json in python.
If I try to use json.dumps(thriftObj)
, it fails with the following:
TypeError: MyThriftObj(...) is not JSON serializable
I tried fixing it with a default function:
json.dumps(thriftObj, default=lambda x: x.__dict__)
This worked in some cases but in other cases I get the error:
AttributeError: 'DictProxy' object has no attribute '__dict__'
How do I convert a valid thrift object to json?