iPhone/iOS JSON parsing tutorial [closed] iPhone/iOS JSON parsing tutorial [closed] ios ios

iPhone/iOS JSON parsing tutorial [closed]


You will love this framework.

And you will love this tool.

For learning about JSON you might like this resource.

And you'll probably love this tutorial.


As of iOS 5.0 Apple provides the NSJSONSerialization class "to convert JSON to Foundation objects and convert Foundation objects to JSON". No external frameworks to incorporate and according to benchmarks its performance is quite good, significantly better than SBJSON.


SBJSON *parser = [[SBJSON alloc] init];NSString *url_str=[NSString stringWithFormat:@"Example APi Here"];url_str = [url_str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:url_str]];NSData *response = [NSURLConnection sendSynchronousRequest:request  returningResponse:nil error:nil];NSString *json_string = [[NSString alloc] initWithData:response1 encoding:NSUTF8StringEncoding]NSDictionary *statuses = [parser2 objectWithString:json_string error:nil]; NSArray *news_array=[[statuses3 objectForKey:@"sold_list"] valueForKey:@"list"];    for(NSDictionary *news in news_array){    @try {        [title_arr addObject:[news valueForKey:@"gtitle"]];    //values Add to title array    }    @catch (NSException *exception) {        [title_arr addObject:[NSString stringWithFormat:@""]];    }