Valid JSON, but 'Cocoa error 3840' from AFNetworking/NSJSONSerialization

可紊 提交于 2019-12-04 05:49:55

NSJSONSerialization uses NSDecimalNumber to represent numbers, and

[NSDecimalNumber decimalNumberWithString:@"4.439049394553e-312"]

already returns NaN, because NSDecimalNumber can represent only numbers

mantissa x 10^exponent         where `-128 <= exponent <= 127`.

So this seems to be a "restriction" (or bug) of NSJSONSerialization, that it works only with numbers in a certain range.

I made a quick test with "SBJsonParser" and it had the same problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!