我有JSON是這樣的:使用NSMutableArray獲取對象?
[{
"username":"bitu","password":"123456", "id":"1"
},
{
"username":"admin","password":"admin", "id":"2"
},
{
"username":"demo","password":"demo", "id":"3"
},
{
"username":"admin","password":"admin", "id":"8"
},
{
"username":"admin","password":"admin", "id":"5"
}]
我想用NSMutableArray
爲獲得"id"
。我如何做到這一點? 請幫幫我!從NSMutableArray
NSString *UserName = [[yourArray objectAtIndex:index] valueForKey:@"username"];//if you required
NSString *Password = [[yourArray objectAtIndex:index] valueForKey:@"password"];//if you required
NSString *UID = [[yourArray objectAtIndex:index] valueForKey:@"id"];
:)
http://stackoverflow.com/questions/12927880/how-to-implement-searching-of-a-string-in-an-array-of-dictionaries/12929788#12929788 – Rajneesh071
跟隨我的答案。 ..使用謂詞...並使用SBJSON類來解析json響應 – Rajneesh071