解析Json串

if ([resopnseObject isKindOfClass:[NSDictionary class]]){
            
            NSDictionary *dictionary = (NSDictionary *)resopnseObject;
            
            NSLog(@"Dersialized JSON Dictionary = %@", dictionary);
            
        }else if ([resopnseObject isKindOfClass:[NSArray class]]){
            
            NSArray *nsArray = (NSArray *)resopnseObject;
            
            NSLog(@"Dersialized JSON Array = %@", nsArray);
            for (int i = 0;i<nsArray.count;i++) {
                NSDictionary *dict = nsArray[i];
                NSLog(@"content:%@",[dict objectForKey:@"content"]);
            }
            return nsArray;
            
        } else {
            
            NSLog(@"An error happened while deserializing the JSON data.");
            
        }

 

你可能感兴趣的:(ios,json)