This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author risa2000
Recipients Arfrever, christian.heimes, cvrebert, eric.araujo, ezio.melotti, jcea, mark.dickinson, mjensen, pitrou, ralhei, rhettinger, risa2000, serhiy.storchaka
Date 2019-08-08.19:46:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565293587.54.0.728245279323.issue16535@roundup.psfhosted.org>
In-reply-to
Content
It looks like I am resurrecting an old item, but I have been just hit by this and was directed to this issue (https://mail.python.org/archives/list/python-ideas@python.org/thread/WT6Z6YJDEZXKQ6OQLGAPB3OZ4OHCTPDU/)

I wonder if adding something similar to what `simplejson` uses (i.e. explicitly specifying in `json.dump(s)` how to serialize `decimal.Decimal`) could be acceptable.

Or, the other idea would be to expose a method in JSONEncoder, which would accept "raw" textual output, i.e. string (or even `bytes`) and would encode it without adding additional characters to it. (as explained in my posts in the other threads).

As it seems right now, there is no way to serialize `decimal.Decimal` the same way it is deserialized, i.e. while preserving the (arbitrary) precision.
History
Date User Action Args
2019-08-08 19:46:27risa2000setrecipients: + risa2000, rhettinger, jcea, mark.dickinson, pitrou, christian.heimes, ezio.melotti, eric.araujo, Arfrever, cvrebert, serhiy.storchaka, ralhei, mjensen
2019-08-08 19:46:27risa2000setmessageid: <1565293587.54.0.728245279323.issue16535@roundup.psfhosted.org>
2019-08-08 19:46:27risa2000linkissue16535 messages
2019-08-08 19:46:27risa2000create