JSON parsing using NSJSONSerialization in iOS

后端 未结 6 1181
孤街浪徒
孤街浪徒 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:28

    First of all in your JSON response dictionary, under the key 'RESPONSE' you have a array not a dictionary and that array contains dictionary object. So to extract username and email ID so as below

    NSMutableDictionary *response = [[[json valueForKey:@"RESPONSE"] objectAtIndex:0]mutableCopy];
     NSString *username = [response valueForKey:@"username"];
     NSString *emailId = [response valueForKey:@"email"];
    

提交回复
热议问题