Richard Musil <risa20...@gmail.com> added the comment:

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-id...@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.

----------
nosy: +risa2000

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue16535>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to