You can specify the default named parameter in the json.dumps() function:
default
json.dumps()
json.dumps(obj, default=lambda x: x.__dict__)
from : https://stackoverflow.com/questions/10252010/serializing-class-instance-to-json
No comments:
Post a Comment