Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6116713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:14:16+00:00 2026-05-23T15:14:16+00:00

I am trying to feed in some JSON data to my iPhone app, the

  • 0

I am trying to feed in some JSON data to my iPhone app, the data is coming in fine as I have NSLog’s telling me so.

The problem I am having is trying to get the results to show in a UITableView. I have a navigation controller underneath a tab bar controller, the navigation controller contains a table view controller which loads another NIB file with a table view connected to a class which is the delegate and data source delegate.

I also need to categorize the results into sections – these being

  • England
  • Scotland
  • Wales
  • N.Ireland

To get an idea of what JSON string I am using see this one.

As you can see the JSON does not cater for the sections but I am yet to implement this, so i would need to know beforehand so I do not have to amend much code later on.

OK – I am using Stig JSON parser.

Here is my ListVenuesView.h (connected to table view)

#import <UIKit/UIKit.h>
#import "SBJson.h"

@interface ListVenuesView : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
    IBOutlet UITableView *venueList;
    NSMutableDictionary *jsonArray;
}

@property (nonatomic, retain) IBOutlet UITableView *venueList;
@property (nonatomic, retain) NSMutableDictionary *jsonArray;

@end

jsonArray is used to store the JSON data and eventually the proper array.

And here is my ListVenuesView.m (key areas in question)

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"Table View Loaded");

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    // This is where we load the JSON data

    NSURL *jsonURL = [NSURL URLWithString:@"http://www.thebigfishexperience.org.uk/sources/ajax/venue-json.php?location=peterborough"];

    NSString *jsonData = [[NSString alloc] initWithContentsOfURL:jsonURL];
    NSLog(@"%@", jsonData);

    // Convert jsonData to array
    self.jsonArray = [jsonData JSONValue];
    NSLog(@"%@", jsonArray);

    NSLog(@"count is: %i", [self.jsonArray count]);

    // Release NSString and NSURL
    [jsonURL release];
    [jsonData release];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [self.jsonArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    NSMutableDictionary *dict = [self.jsonArray objectAtIndex: indexPath.row];

    cell.textLabel.font = [UIFont fontWithName:@"Arial" size:15.0];

    cell.textLabel.text = [dict objectForKey:@"venueName"];
    cell.detailTextLabel.text = [dict objectForKey:@"venueCordDist"];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    // Configure the cell...

    return cell;

Also how can I use the data in the cells to go to another subview of the nav controller which gives me a back button and displays the info from the JSON string just for that particular cell that has been tapped.

I think this has something to do with it? Not sure though as this is my first app i am building! So probably expect more pleas of assistance – ha ! 😉

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
    /*
     DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"Nib name" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.
     [self.navigationController pushViewController:detailViewController animated:YES];
     [detailViewController release];
     */
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:14:17+00:00Added an answer on May 23, 2026 at 3:14 pm

    On selecting a row, as mentioned by u, we are navigating to another view. Let us assume that the view controller is DetailViewController which is a sub-class of UIViewController.

    In the DetailViewController.h , declare a NSDictionary object.

    In DetailViewController.m, add

    -(void)setVenueDict:(NSDictionary*)venueDict
    {
        if( _venueDict )
        {
          [_venueDict release];
        }
        _venueDict = [venueDict retain];
    
    }
    

    In ParentViewController, ur didSelectRow.. method should be like this.

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        // Navigation logic may go here. Create and push another view controller.
    
         DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"Nib name" bundle:nil];
         // ...
         // Pass the selected object to the new view controller.
         NSDictionary *dict = [self.jsonArray objectAtIndex: indexPath.row];
         [detailViewController setVenueDict:dict];
         detailViewController.title = [dict objectForKey:@"venueName"];
         [self.navigationController pushViewController:detailViewController animated:YES];
         [detailViewController release];
    
    }
    

    In the second view controller, u can do whatever u want with the _venueDict.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi, i have been having some problems using JSON data in flash builder lately
So I have an app that downloads and parses a JSON feed with some
I am trying to show some info from a feed and I have problem
I'm trying to fill some data from an xml feed we made into my
I am working on PostgreSQL and psycopg2. Trying to get feed data which is
I am trying to get facebook wall but I am having issues with JSON
I'm trying to parse an mrss feed using jquery but am having some difficulty
Some json from picasaweb: http://picasaweb.google.com/data/feed/api/user/100489095734859091829?kind=album&access=visible&alt=json-in-script&thumbsize=144c Here's the output as tidied up by jsonview -
I have the following data that I am trying to feed into a Handlebar
I'm trying to decode a JSON feed containing some Cyrillic characters. Not all of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.