-(void)parseDataFromServer:(NSData*)responseData {NSError* error;// If response JSON starts with {}, it represents dictionaryNSDictionary *dicData = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
// If response JSON starts with [], it represents array
NSArray* arrData = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
if (error) NSLog(@"%@",error.localizedDescription);
}
Class: NSJSONSerialization
Method: + (NSData *)dataWithJSONObject:(id)obj
options:(NSJSONWritingOptions)opt
error:(NSError **)error;
Reference Links: Apple Doc
No comments:
Post a Comment