JSON NaN bug All In One


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, 禁止转载 🈲️,侵权必究⚠️!



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM