加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

NSJSONSerialization 转换时 类型注意

发布时间:2020-12-16 19:08:54 所属栏目:百科 来源:网络整理
导读:进行JSON转化的时候,需要满足一下的要求。 An object that may be converted to JSON must have the following properties: The top level object is an NSArray or NSDictionary. All objects are instances of NSString,NSNumber,NSArray,NSDictionary,or


进行JSON转化的时候,需要满足一下的要求。


An object that may be converted to JSON must have the following properties:

  • The top level object is an NSArray or NSDictionary.
  • All objects are instances of NSString,NSNumber,NSArray,NSDictionary,or NSNull.
  • All dictionary keys are instances of NSString.
  • Numbers are not NaN or infinity.

也就是说,
  1. 最上面层,必须是 NSArray 或 NSDictionary
  2. 所有的value 必须是 NSString,NSNubmer,NSDictionar 或 NSNull.
  3. 所有的key 必须是 NSString
  4. 并且Numbers 不能是 NaN 或 无穷大。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读