我在 Android 中轻松做到了,但我几乎没有在 iOs 中做到这一点。我的json就像:
[{"name":"qwe","whatever1":"asd","whatever2":"zxc"},
{"name":"fgh","whatever1":"asd","whatever2":"zxc"}]
如果我做:
NSData *jsonData = [data dataUsingEncoding:NSUTF32BigEndianStringEncoding];
rows = [NSJSONSerialization JSONObjectWithData: jsonData options: NSJSONReadingMutableContainers error: &error];
我可以在行中访问吗?
NSString *name = [[rows objectAtIndex:0] [objectForKey:@s"name"]];
或者我该怎么做?谢谢。
终于 NSString *name = [[rows objectAtIndex:0] objectForKey:@"name"]];
成功了!:D