iOS Tutorial - JSON Parsing

Tony's Programming Stuff · 72K views · 2012 · 25:39

Open on YouTube

Software (other)Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a step-by-step guide for turning JSON into table view rows, and many cite it as the tutorial their own code was based on.

Recommended by 4 people across 3 different months, 2012 to 2014.

What it is

A 25-minute screencast by Tony's Programming Stuff showing how to fetch JSON from a web service in iOS, parse it, and list the results in a UITableView. It is built in Xcode 4 using Objective-C and NSURLConnection.

What people said

Recommends Kevin Kelly · 2012-12 · Stack Overflow · on “No visible @ interface for 'NSMutableArray' declares selector 'appendData:'”

I followed this great video tutorial: [this video] Changing the header to NSMutableData cleared all errors and warnings. Thanks!

Recommends RockPaperScissors · 2013-02 · Stack Overflow · on “How to turn JSON data into an array in xcode”

I am fairly new to iOS development and I have been trying to figure out how I can convert the following string into an array and then displaying that array in a UITableView {"Result":"OK","Users":[{"name":"The King","email":"king@gmail.com"},{"name":"The Resteruant","email":"theresturaunt@gmail.com"}]} What I want to get is an array for the "name" and a separate array for "email" This is what i have so far: strURL = [NSString stringWithFormat:@" [LINK] "]; dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]]; strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]; NSLog(@"%@", strResult); I have installed a JSON library but I dont know how to use i

Recommends Brent · 2013-02 · Stack Overflow · on “JSON and dynamic TableView”

I found this video really usefull for learning. [LINK] Also check some of my questions I ask alot about JSON but videos are a good way to move forward. More Links :) [LINK] [this video]

Recommends Rohan Kumar · 2014-08 · Stack Overflow · on “How can I get data from MySql using PHP in my Xcode app?”

In the arabic case you can use JSON_UNESCAPED_UNICODE for default behaviour like echo json_encode($yourdata, JSON_UNESCAPED_UNICODE); Also use charset=utf-8 also Read this [LINK] Try to get response in NSArray then convert it in JSON or see the video tutorial [this video] which may helps you.

Cites Karthik Kamalakannan · 2012-12 · Stack Overflow · on “Parse Wordpress JSON into UITableView on iOS”

I'm trying to parse a JSON from this URL [LINK] , which is a JSON output from Wordpress. For some reason, there's no output in the UITableView. Here's the code I have got to parse. I'm sure I'm missing out something but I'm not able to figure out how to parse Nested JSON in this code. ViewController.m: - (void)viewDidLoad { [super viewDidLoad]; self.title = @"News"; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; NSURL *url = [NSURL URLWithString:@" [LINK] "]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; // Do any additional setup after loading the view, typically from a nib. } - (void)con

Cites Fahim Parkar · 2013-01 · Stack Overflow · on “Code working with xib, but not with Storyboard”

I am newbie for iPhone application. I am learning how to get the JSON data and parse it and show it in table in iPhone. For that I am going through this video [this video] . I made this with xib file and its working perfectly. What I was trying is do this with Storyboard . I did same thing as I did for Stoaryboard , however the execution is getting break at below line. cell.textLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"title"]; Code I have is -(UITableViewCell *) tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"i m here 1"); UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainCell"]; NSLog(@"i m here 2"); if

Cites Fahim Parkar · 2013-01 · Stack Overflow · on “How to find/ delete the CUSTOM row detail of UITableViewCell”

This question is bit related to my earlier question I am newbie for iPhone application and trying to learn UITableView with JSON . I followed this video [this video] for learning. I created same example using Stoaryboard and also added new screen where I can add data. Now I was trying to delete the data. So what I did is thought is instead of below method, I will add button on each row and on clicking of that I will delete the data. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath But I am not getting how I will get the row details and how to delete. Any help/ suggestion would be grateful. Below is h

Cites Kevin Kelly · 2013-01 · Stack Overflow · on “Splitting JSON topics into sections in tableview”

I am reading articles from a webserver, which come in JSON format, and displaying them in tableview. I want to implement section headers, with each section being a topic. So far there are only 3 topics and the code in 'numberOfSectionsInTableView' below correctly determines that there are 3 sections. My trouble is with the next function, 'numberOfRowsInSection'. I cannot figure out how to determine the number of rows in each section. I have looked at other answers on stack overflow and the reason none have helped me is that I have a variable number of sections and rows, whereas most other questioners have a fixed number of sections. Any ideas? FYI 'news' is the array of articles in JSON form

Cites Aroel Haqi · 2013-02 · Stack Overflow · on “Parsing multiple jSon in IOS”

For my code, I am following instruction on this link [this video] and success, but I want to modify to multiple JSON and failed (if i print log, that its running). I modify in: - (void)viewDidLoad - (void)connectionDidFinishLoading:(NSURLConnection *)connection This is my modified code(ViewController.m) : #import "ViewController.h" #import "DetailViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.title = @"News"; //[UIApplication sharedApplication].networkActivityIndicatorVisible = YES; //before //NSURL *url = [NSURL URLWithString:@" [LINK] "]; //after NSURL *url = [NSURL URLWithString:@" [LINK] "]; NSURLRequest *requ

Cites Brian Barthold · 2014-02 · Stack Overflow · on “json elements not being passed to table view”

I have a simple JSON feed which I can parse and see in the console but I can't seem to get it to display in my table view. I am using Xcode 5.0.2. I am not sure why I can see it in the for loop when echoed to the console, but not in the table view. FYI, I am brand new to building in xcode and objective c and I am using this video tutorial [this video] as guide. My Json looks like this: [ { "first_name": "Bill" }, { "first_name": "Ted" }, { "first_name": "George" } etc... ] PhotoTableViewController.h #import #import "DisplayViewController.h" @interface PhotosTableViewController : UITableViewController { IBOutlet UITableView *mainTableView; NSArray *news; NSMutableData *data; } @end PhotoTableViewC