This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Haoyu SUN
Recipients Haoyu SUN, eric.smith
Date 2020-05-15.14:28:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589552924.28.0.456445821354.issue40633@roundup.psfhosted.org>
In-reply-to
Content
Thank you for the timely reply, Eric.

How about we add an optional argument (like the argument "ignore_nan" defaults to False as the package simplejson does) to functions like json.dumps(). So that user can choose whether he needs NaN encoded as NaN or null, meanwhile the default behavior stays the same.

In chromium based browsers, the function JSON.parse cannot parse it correctly. Here is an example below:
> JSON.parse('{"a": null, "b": NaN}')
uncaught SyntaxError: Unexpected token N in JSON at position 17
    at JSON.parse (<anonymous>)
    at <anonymous>:1:6
History
Date User Action Args
2020-05-15 14:28:44Haoyu SUNsetrecipients: + Haoyu SUN, eric.smith
2020-05-15 14:28:44Haoyu SUNsetmessageid: <1589552924.28.0.456445821354.issue40633@roundup.psfhosted.org>
2020-05-15 14:28:44Haoyu SUNlinkissue40633 messages
2020-05-15 14:28:44Haoyu SUNcreate