On 09/08/2019 16:05, Joao S. O. Bueno wrote:
I spent some minutes now trying to encode a Decimal as a JSON "Number" using Python native encoder - it really is not possible. The level of customization for Python encoders just allows a method ("default") that have to return a "known" object type - and if it returns a string, it is included with quotes in the final output - which defeats writting numbers.
I still need some persuasion that this is not the right behaviour as it stands. I get what you want -- "this string of digits is the representation I want to use, please don't put quotes around it" -- but I can't help but feel that it will only encourage more unrealistic expectations.