JSON NaN bug All In One
JSON NaN bug
NaN is not valid in JSON
JSON
JSON {Symbol(Symbol.toStringTag): "JSON", parse: ƒ, stringify: ƒ}parse: ƒ parse()stringify: ƒ stringify()Symbol(Symbol.toStringTag): "JSON"__proto__: Object
obj = {score: NaN}
{score: NaN}score: NaN__proto__: Object
JSON.stringify(obj);
"{"score":null}"
JSON.parse(JSON.stringify(obj))
{score: null}score: null__proto__: Object
{"score": NaN}
JSON
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
isNaN
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/isNaN
refs
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
https://jsonformatter.curiousconcept.com/
https://perlmaven.com/parsing-nan-in-json
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!