In response to the additional work required to convert the new python
dataclass using the json encoder I propose an __encode__ method that will
be included in the default dataclass attributes. This would then be picked
up by the default json encoder and called to encode the object. Using a
common __encode__ tag would allow the solution to also be applied to custom
objects and other new objects without needing to update all json encoders.
The __encode__ method would work similar to __repr__ but output a json
string of the object.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YGUCQH2XGERESIIWZ4TBU74HJKZATDWB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to