JSON parsing using NSJSONSerialization in iOS

后端 未结 6 1183
孤街浪徒
孤街浪徒 2020-12-05 16:36

I am parsing a JSON in my code. But I am getting some unexpected issues while retrieving data of parsed JSON. So let me explain my problem.

6条回答
  •  感情败类
    2020-12-05 17:18

    RESPONSE contains an array not an object.

    So try like this:

    NSMutableArray *response = [json valueForKey:@"RESPONSE"];
    NSString *username = [[response objectAtIndex:0] valueForKey:@"username"];
    NSString *emailId  = [[response objectAtIndex:0] valueForKey:@"email"];
    NSLog(@"User=>[%@] Pwd=>[%@]",username ,emailId );
    

提交回复
热议问题