On Sat, Jun 27, 2020 at 03:33:55PM +0300, Serhiy Storchaka wrote: > 27.06.20 11:58, Steven D'Aprano пише: > >The JSON standard didn't just accidently fail to specify what to do with > >NANs and INFs. It mandates that they are turned into null. JSON is > >designed to take your numeric data and throw values away, and this is a > >real problem for people: > > Could you please give a cite and a reference to the standard that > contains such requirement?
Douglas Crockford recommended using nulls in place of NaNs: http://www.json.org/json.ppt (Look at slide 16) The RFC states that Infinity and NaN are not permitted (but doesn't explain what to do with them): https://tools.ietf.org/html/rfc4627 and ECMA-262 section 24.5.2, JSON.stringify, NOTE 4, page 683 states: "Finite numbers are stringified as if by calling ToString(number). NaN and Infinity regardless of sign are represented as the String null." http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/GKQZVPVAYP65VTSSUCGN4WG2ZVPB7JG4/ Code of Conduct: http://python.org/psf/codeofconduct/