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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:18:41+00:00 2026-05-28T18:18:41+00:00

I have a JSON file, and i need to extract values from it and

  • 0

I have a JSON file, and i need to extract values from it and display on my tableview. Everything works fine.

{
    "1": {
        "name": "Jemmy",
        "birthday": "1994-11-23"
    },
    "2": {
        "name": "Sarah",
        "birthday": "1994-04-12"
    },
    "3": {
        "name": "Deb",
        "birthday": "1994-11-23"
    },
    "4": {
        "name": "Sam",
        "birthday": "1994-11-23"
    }
} 

When i display the values, it doesn’t get displayed in the order of 1,2,3,4 as given in the records. It just gets displayed randomly. I have included my code below, I need it to be modified so i could display the content in the order given above. Can someone please help ?

- (void)requestSuccessfullyCompleted:(ASIHTTPRequest *)request{
                NSString *responseString = [request responseString];
                SBJsonParser *parser = [SBJsonParser new];               
                id content = [responseString JSONValue];
                if(!content){       
                    return;
                }
                NSDictionary *personDictionary = content;
                NSMutableArray *personMutableArray = [[NSMutableArray alloc] init];
                for (NSDictionary *childDictionary in personDictionary.allValues)
                {
                    Deal *deal = [[Deal alloc] init];            
                    deal.name=[childDictionary objectForKey:@"name"];
                    deal.dob=[childDictionary objectForKey:@"birthday"];
                    [personMutableArray addObject:deal];
                }        
                self.personArray = [NSArray arrayWithArray:personMutableArray];    
    }

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";
        Cell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {        
            Person *person = [self.personArray objectAtIndex:indexPath.row];        
            cell = [[Cell alloc] initWithStyle:UITableViewCellStyleDefault 
                               reuseIdentifier:CellIdentifier];
            cell.namelabel.text=person.name;   
            cell.doblabel.text=person.dob;  
        }
        return cell;
    }
  • 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-28T18:18:42+00:00Added an answer on May 28, 2026 at 6:18 pm

    You’re not reusing your cell correctly. If the cell is being reused, you fail to configure it.

    Your cellForRowAtIndexPath: should be this way:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";
        Cell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {        
            cell = [[Cell alloc] initWithStyle:UITableViewCellStyleDefault 
                               reuseIdentifier:CellIdentifier];
        }
        Person *person = [self.personArray objectAtIndex:indexPath.row];        
        cell.namelabel.text=person.name;   
        cell.doblabel.text=person.dob;  
        return cell;
    }
    

    Note that this is correct ARC code, but in pre-ARC, you need to add autorelease to the end of the [Cell alloc] line.

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

Sidebar

Related Questions

I have a web service that queries data from this json file, but I
I have a JSON file that I would like to create an array from.
I need to load a JSON file from a remote link and show the
I need to parse data from one JSON file in order to validate arrays,
I have a JSON file which I need to iterate over, as shown below...
I have one big div with id=elements and I load from JSON file new
I need to get rather complicate JSON data from (large) JSON file into a
I have one view where I read json data. and extract keys from it.
I now have a working JSON formatted file from my PHP scripts. The next
So, I have a json file and I want to get the names 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.