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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:47:24+00:00 2026-06-11T05:47:24+00:00

I found this part of code in a tutorial for parsing json objects: –

  • 0

I found this part of code in a tutorial for parsing json objects:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    NSLog(@"connectionDidFinishLoading");
    NSLog(@"Succeeded! Received %d bytes of data",[self.responseData length]);

    // convert to JSON
    NSError *myError = nil;
    NSDictionary *res = [NSJSONSerialization JSONObjectWithData:self.responseData options:NSJSONReadingMutableLeaves error:&myError];

    // show all values
    for(id key in res) {

        id value = [res objectForKey:key];

        NSString *keyAsString = (NSString *)key;
        NSString *valueAsString = (NSString *)value;

        NSLog(@"key: %@", keyAsString);
        NSLog(@"value: %@", valueAsString);
    }

    // extract specific value...
    NSArray *results = [res objectForKey:@"results"];

    for (NSDictionary *result in results) {
        NSString *icon = [result objectForKey:@"icon"];
        NSLog(@"icon: %@", icon);
    }

}

I was able to use that code and parse data when my JSON object was of that form:

{"data_1":0,"data_2":0,"Plato 1":0,"data_3":0....} and I was just searching for specific keys, named data_1 and so on.

Now I am fetching data over DB so my JSON object is an array.

JSON object is of that form:

[{"0":"1","id":"1","1":"text1","image":"text2","2":"0"}]

What changes do I have to make?

  • 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-06-11T05:47:25+00:00Added an answer on June 11, 2026 at 5:47 am

    Your example is simply wrong. For the general case you should receive the parse result into an NSObject pointer, then test its type with isKindOfClass. What you’re getting back is not an NSDictionary but rather an NSArray containing one entry that is an NSDictionary.

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

Sidebar

Related Questions

Hey, in a tutorial C++ code, I found this particular piece of confusion: PlasmaTutorial1::PlasmaTutorial1(QObject
I was checking out a tutorial, found at http://www.codecommit.com/blog/scala/scala-for-java-refugees-part-4 This tutorial is from jan.
found this little code snippet that seems to do what i want, but im
I found this code on the internetz, it checks the current page url; function
I am trying to imitate this tutorial about creating a simple Apple-themed breadcrumb found
i'm trying to do this tutorial here http://docs.xamarin.com/android/tutorials/Maps_and_Location/Part_2_-_Maps_API and basically this is my code
I found this tutorial which uses jQuery and validation plugin to validate form input.
I found a good tutorial and code on how to display a Facebook news
Consider this part of code: Try arqTXT.LoadFromFile(LogPath); finally ShowMessage( The log file could not
Found this bit of code in FrogCms function isWritable($file=null) { $perms = fileperms($file); if

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.