Reputation: 9579
I have this bit of code:
[self.vManager playersNearLocation:userLocation
block:^(NSSet *players, NSError *error)
{
if(players && [players count])
{
NSLog(@"Success in getting players");
/* TO DO
Convert JSON to Objective C object here
*/
}else{
NSLog(@"Failed to get players");
}
}];
I am receiving JSON from the server, how do I convert it to a Dictionary or array object. I dont want to use any external libraries, is there a native way?
Thanks
Upvotes: 0
Views: 1508
Reputation: 641
Try NSJSONSerialization
and method
+ (id)JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(NSError **)error
Upvotes: 3