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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:38:04+00:00 2026-05-26T14:38:04+00:00

Hey guys :) I am quite new to stack overflow and iPhone programming. I

  • 0

Hey guys 🙂 I am quite new to stack overflow and iPhone programming. I am trying to parse a complex JSON to display some stuff in the UITableView.

a part of the JSON structure –

{"1":{"1":"Ent1","done":"No"},"2":{"1":"Ent2","done":"No"}}

I am able to parse through the main keys “1” and “2” and able to grab the values corresponding to the key “1” inside {“1″:”Ent1″,”done”:”No”}, {“1″:”Ent2″,”done”:”No”} store them into a dictionary/ a string with the following code :

for (NSString *key in dict)
{
    NSString *answer = [dict objectForKey:@"1"];
    NSLog(@"%@", answer);
}

The result is Ent1 and Ent2 because the code iterates over the for loop and checks for the objects with key “1”.

The problem is this – I want to store both the values(Ent1 and Ent2) into an array.

I use the following code:

NSMutableArray *array = [[NSMutableArray alloc] initWithObjects: answer, nil];

but it just takes the last index in the dictionary which is Ent2.

Could you please tell me how could I add both the values for key 1 into an array?

Thanks in advance 🙂

  • 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-26T14:38:04+00:00Added an answer on May 26, 2026 at 2:38 pm
    NSMutableArray *array = [[NSMutableArray alloc] init];
    
    for (NSString *key in dict) 
    { 
        NSString *answer = [dict objectForKey:key];
        [array addObject:answer];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey there guys, this is my first question on Stack Overflow. I figured this
Hey guys, I've been browsing around on SO for quite some time and can't
Hey guys quite new to smarty and was wondering if i could load templates
Hey guys! First of all, I know this kind of stuff is quite shitty,
hey guys, i was using Json dll in my project from quite sometime now
Hey guys, this should be quite simple to answer.... Im using XSB Prolog...trying to
Hey guys... Its quite late in the night right now and I'm taking some
Hey guys, sorry I'm kind of new to programming, but I had a small
Hey guys i am trying to automate my system at work for sending artwork
Hey guys, lately I have been asking quite a few questions about memory management

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.