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

  • Home
  • SEARCH
  • 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 6876647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:30:13+00:00 2026-05-27T04:30:13+00:00

I am grabbing a JSON output into a NSDictionary, the JSON output looks somewhat

  • 0

I am grabbing a JSON output into a NSDictionary, the JSON output looks somewhat like this –

{"1":[{"abc":11},{"abc":13}]}

I was successful in grabbing they value for the first key 1 using the following:

NSDictionary *getData = [JSONOutput objectForKey:@"1"];

Problem- Now, I want to grab they values for keys “abc” and throw it into a MutableArray. I am using this for grabbing the values for key abc but it doesn’t seem to be working

int count = 0;
NSMutableArray *array = [NSMutableArray alloc] init];

for (NSString *key in getdata)
{
 [array addObject:[getdata objectForKey:@"abc"] atIndex:count];
count ++;
}

Note: JSONOutput is another dictionary where the JSON output is going in. I am allocating and initializing the dictionaries too.

Please help! I know its a really simple one but I have no clue where I am going wrong at..

  • 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-27T04:30:13+00:00Added an answer on May 27, 2026 at 4:30 am

    The element for key “1” is an array, not a dictionary (note the square bracket and the elements separated by a comma). The elements in the array are dictionaries. So:

    NSArray *getData = [JSONOutput objectForKey:@"1"];
    for (NSDictionary *dict in getdata)
    {
        [array addObject:[dict objectForKey:@"abc"]];
    }
    

    Also, you don’t need to use the count argument for addObject: if you are adding objects sequentially from zero.

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

Sidebar

Related Questions

I am grabbing a JSON response from AJAX request, the output is something like
I'm grabbing some JSON from YQL, parsing it into a list. Then I want
Trends data from Twitter Search API in JSON. Grabbing the file using: $jsonurl =
I have a xsl file that is grabbing variables from xml and they seem
I have this method for grabbing the file name from a string URI. What
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function
I am grabbing this strange URL out of an Object in a Twitter button:
I'm grabbing various jquery objects to put into an array and later spit out
So I'm grabbing a JSON via AJAX, but need to re-configure it. Part 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.