title: SBJson Data Reading and Displaying NSDictionary Objects in Uitableview xcode
body: <p>Developing full C.R.U.D. app on a remote database. My app is working correctly as of publishing this question. However I would like to advance it. I am a newbie to IOS development. As you can see from my code I am getting the valueForKey name and displaying it in the tableview. Clicking on the name brings you to screen with the name in a text field. However I want to get the valueForKey for the following keys: namesid, address1, address2,address3,address4, email, mobile,telephone and comment and display them as for the name all values will be displayed in their own text fields.</p>
  
  <pre><code>- (void)requestFinished:(ASIHTTPRequest *)request
  {
  //Enable the Reload Button.
  self.navigationItem.leftBarButtonItem.enabled = YES;
  //Enable the Add Contact Detail Button.
  self.navigationItem.rightBarButtonItem.enabled = YES;
  
  searchBar.hidden = NO;
  
  SBJsonParser *parser = [[SBJsonParser alloc] init];
  
  if (request.responseStatusCode == 200) {
  
      [self.activityIndicator stopAnimating];
  
      NSString *json_string = [request responseString];
  
      // Actually parsing the JSON
      NSArray *statuses = [parser objectWithString:json_string error:nil];
  
      for (NSDictionary *status in statuses){
          @try {
  
              [remotecontacts addObject:[status valueForKey:@"name"]];
  
          }
          @catch (NSException *exception) {
  
              [remotecontacts addObject:[NSString stringWithFormat:@""]];
  
          }
  
      } // end for
  
      NSDictionary *remotecontactsInDict = [NSDictionary dictionaryWithObject:remotecontacts forKey:@"Contacts"];
  
      [listOfItems addObject:remotecontactsInDict];
  
      [self.myTableViewController reloadData];
  
  
  } else {
  
      //Enable the Reload Button.
      self.navigationItem.leftBarButtonItem.enabled = YES;
      //Enable the Add Contact Details Button.
      self.navigationItem.rightBarButtonItem.enabled = YES;
  
      //Stop the Activity Indicator.
      [self.activityIndicator stopAnimating];
  
      UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle:@"Error"   message:@"Unexpected error, please try again later!"delegate:self cancelButtonTitle:@"Ok"otherButtonTitles:nil];
      [myAlert show];
      [myAlert release];
      return;
  }
  
  
  }
  
  // Customize the appearance of table view cells.
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:     (NSIndexPath *)indexPath {
  
  static NSString *CellIdentifier = @"Cell";
  
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
      cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
  }
  
  // Set up the cell...
  
  if(searching) 
      cell.text = [copyListOfItems objectAtIndex:indexPath.row];
  else {
  
      //First get the dictionary object
      NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
  
      NSArray *array = [dictionary objectForKey:@"Contacts"];
      NSString *cellValue = [array objectAtIndex:indexPath.row];
      cell.text = cellValue;
  
  }
  
  return cell;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>// Customize the number of rows in the table view.
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  
  if (searching)
      return [copyListOfItems count];
  else {
  
      //Number of rows it should expect should be based on the section
      NSDictionary *dictionary = [listOfItems objectAtIndex:section];
      NSArray *array = [dictionary objectForKey:@"Contacts"];
      return [array count];
  
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  
  //Get the selected country
  
  NSString *selectedCountry = nil;
  
  if(searching)
      selectedCountry = [copyListOfItems objectAtIndex:indexPath.row];
  else {
  
      NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
      NSArray *array = [dictionary objectForKey:@"Contacts"];
      selectedCountry = [array objectAtIndex:indexPath.row];
  }
  
  //Initialize the detail view controller and display it.
  DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
  dvController.selectedCountry = selectedCountry;
  [self.navigationController pushViewController:dvController animated:YES];
  [dvController release];
  dvController = nil;
  </code></pre>
  
  <p>}</p>