我在Android中很容易做到這一點,但是我很少在iOs中做到這一點。 我的JSON是這樣的:我如何解析數組JSON中的objective-c
[{"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"]];
或者我該怎麼做?謝謝。
FINALLYNSString *name = [[rows objectAtIndex:0] objectForKey:@"name"]];
WORKS! :d
當你嘗試過時發生了什麼? – vikingosegundo 2013-02-15 10:27:07