no, the json encoder shouldn't change. But a clear warning in the docs is a fine idea.
However, I do want to note that JSON is not "broken." The data that gets represented in JSON may have the type "Number" (RFC 7159). That is, there is no concept of IEEE-754 floating point, or integer, or Decimal, etc. There is simply the type "Number" that a particular programming language may approximate in one of its available types.
Well, maybe not "Decimal", but it IS, in fact decimal -- i.e. base 10 -- it can only exactly represent values that can be exactly represented in base 10.
Which is why, performance aside, it would be better if a JSON number mapped to a Python Decimal, rather than a float.
Which I'd still like to see happen, at least optionally.
-CHB
--
Christopher Barker, PhD
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython