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 4055698
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:44:02+00:00 2026-05-20T14:44:02+00:00

I have a question with respect to putting JSON data into a table view.

  • 0

I have a question with respect to putting JSON data into a table view. I’m at the point where I have successfully parsed the data, as its coming up in my console – but I cant for the life of me figure out how to put this data into my table view. I’ve spent a whole week solid trying to get this to work trying every combination of things under the sun.

Most of the time it just crashes, sometimes it tells me “[NSCFString count]: unrecognized selector” which I believe happens because I’m trying to count a string which throws an exception? – Anyways, with the code below, it just prints the data I want in the console and shows me a load of grey lines in the table view, so its not crashing (which is the best I can do at the moment I guess).

Any help/advice on how to populate the table with all of the eventNames will be greatly appreciated. My eventual plan for this view was to have the eventNames in the list which when selected push a new view controller showing data for that specific event.

Here’s the view did load method:

- (void)viewDidLoad {
[super viewDidLoad];

NSURL *url = [NSURL URLWithString:@"http://myurl........."];
NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:url];

NSLog(jsonreturn); //successfully returns the result of the page

    //to parse it i have made a sbjsonparser object
    SBJsonParser *json = [[SBJsonParser new] autorelease];
    NSError *jsonError;
    NSDictionary *parsedJSON = [json objectWithString:jsonreturn error:&jsonError];

        //if successful, i can have a look inside parsedJSON - its worked as an NSdictionary and NSArray
        NSArray* events = [parsedJSON objectForKey:@"Events"];
        //eventNameList = [parsedJSON objectForKey:@"Events"];
        NSLog(@"show me events: %@", events);
        //NSLog(@"show me events: %@", eventNameList);

            //lets try and get to rows
            //NSEnumerator *enumerator = [events objectEnumerator];
            NSEnumerator *enumerator = [events objectEnumerator];
            NSDictionary* item;
                while (item = (NSDictionary*)[enumerator nextObject]) {
            NSLog(@"event item:eventName = %@", [item objectForKey:@"EventName"]); //everything to this point works and shows in the console

            }

}

And here is the table view code:

//customise the number of sections in the table view
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

//customise number of rows
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [eventNameList count];

NSLog(@"here");

}

//customise the appearance of table view cells
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

//try to get a reusable cell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

//create a new cell if there is not reusable cell available
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

//set the text display for the cell
NSString *cellValue = [eventNameList objectAtIndex:indexPath.row];

cell.textLabel.text = cellValue;

//NSLog(@"event item from table view:eventName = %@", eventNameList);

return cell;
}

Thanks in advance, any help or pointers are greatly welcomed and appreciated 🙂

  • 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-20T14:44:02+00:00Added an answer on May 20, 2026 at 2:44 pm

    If I were you, I’d create a custom object:

    NSEnumerator *enumerator = [events objectEnumerator];
    NSDictionary* item;
    
    while (item = (NSDictionary*)[enumerator nextObject]) {
      Event *event = [[Event alloc] init];
      event.eventName = [item objectForKey:@"EventName"];
      // set more properties here
      [eventNameList addObject:event];
      [event release];
    }
    

    Then you can use the following in your cellForRowAtIndexPath:

    Event *event = (Event *)[eventNameList objectAtIndex:indexPath.row];
    
    cell.textLabel.text = event.eventName;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.