JSON 本质上,就是一个"特殊格式"的字符串
Javascript
的子集,专门负责描述数据格式Javascript
是做网页开发使用的一种"脚本"语言Javascript
& Java
没有任何关系!key/value
值对表示true
或 false
)null
NSArray
/ NSDictionary
转换成二进制的过程NSArray
/ NSDictionary
的过程NSURL *url = [NSURL URLWithString:@"http://www.weather.com.cn/adat/sk/101010100.html"];
id result = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
NSLog(@"%@ %@", result, [result class]);
选项 | 说明 |
---|---|
NSJSONReadingMutableContainers = (1UL << 0) |
容器可变 |
NSJSONReadingMutableLeaves = (1UL << 1) |
叶子可变 |
NSJSONReadingAllowFragments = (1UL << 2) |
顶级节点可以不是 NSArray 或者 NSDictionary |
原文:http://www.cnblogs.com/jiangshengkai/p/4896545.html