NSJSONSerialization 转换JSON数据的 NSJSONReadingOptions的意思

[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingOptions error:&error];

NSJSONReadingOptions有三个枚举值,具体含义如下:

1.NSJSONReadingMutableContainers :Specifies that arrays and dictionaries are created as mutable objects. 

指定方法创建的数组和字典是可变的对象。(意思就是 JSONObjectWithData 方法返回的JSON对象中的字典和数组都是mutable的。)

2.NSJSONReadingMutableLeaves :Specifies that leaf strings in the JSON object graph are created as instances of NSMutableString. 

指定方法创建的字符串是可变的对象。(相比较NSJSONReadingMutableContainers, 意思是数组和字典里的成员是可变的字符串。)

3.NSJSONReadingAllowFragments:Specifies that the parser should allow top-level objects that are not an instance of NSArray or NSDictionary. 

指点转换器应该允许顶层的对象不是一个数组或则字典的实例。

posted @ 2014-08-15 21:39  xupeiying  阅读(316)  评论(0编辑  收藏  举报