JSON Pershing from NSString using NSJSONSerialization in iOS-9 (Objective-c)

Samsul Hoque
0


First you will need to convert your NSString to NSData by doing the following:
NSData *data = [stringData dataUsingEncoding:NSUTF8StringEncoding];
Now convert NSData to NSDictionary using NSJSONSerialization:
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data 
options:kNilOptions    error:&error];

Create NSArray OR NSDictionary:
NSArray* latestLoans = [json objectForKey:@"result"];
NSLog(@"loans: %@", latestLoans);


Post a Comment

0Comments
Post a Comment (0)