-(id)_JSONParser:(NSString*)JSONString{
NSData* jsonData = [JSONString dataUsingEncoding:NSUTF8StringEncoding];
NSError* error = nil;
NSArray* jsonArray = nil;
NSDictionary* jsonDictionary = nil;
if (jsonData) {
id _jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
if ([_jsonObject isKindOfClass:[NSDictionary class]]) {
jsonDictionary = (NSDictionary*)_jsonObject;
NSLog(@"%@",jsonDictionary);
return jsonDictionary;
}else if ([_jsonObject isKindOfClass:[NSMutableArray class]]) {
jsonArray = (NSArray*)_jsonObject;
NSLog(@"%@",jsonArray);
return jsonArray;
}
}
return nil;
}
沒有留言:
張貼留言