YOur code is perfect you just have to return dictionary in stead of resultobject as @iPatel said.
Replace this code in your code..
-(NSDictionary*)parseJSON:(NSString*)jsonString
{
NSData *data=[jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
id resultObject=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
NSDictionary *jsonDictionary;
if([resultObject isKindOfClass:[NSDictionary class]]){
NSLog(@"its an dictionary");
jsonDictionary=(NSDictionary*)resultObject;
NSLog(@"jsonDictionary : %@",jsonDictionary);
} else {
NSLog(@"its probably a array");
NSArray *jsonArray=(NSArray*)resultObject;
NSLog(@"jsonArray : %@",jsonArray);
}
return jsonDictionary;
}
But your code contain NSArray also does that means json can be either array or dictionary than you have to change your return type to id so you can return any item.