[issue40633] json.dumps() should encode float number NaN to null

Raymond Hettinger report at bugs.python.org
Fri May 15 23:36:21 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

[Eric]
> this is documented behavior

[Mark]
> I definitely wouldn't want to see nans translated to 
> "null" by default.

I concur with both of these statements.

I would support adding an option (off by default) to convert NaNs to None.  While NaNs were originally intended to indicate an invalid value, they sometimes get used to denote missing values.  In those situations, it would be reasonable to convert NaN to null.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40633>
_______________________________________


More information about the Python-bugs-list mailing list