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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:26:24+00:00 2026-06-12T11:26:24+00:00

Possible Duplicate: How to use NSJSONSerialization I am testing to use the web service

  • 0

Possible Duplicate:
How to use NSJSONSerialization

I am testing to use the web service of my website on iphone Application.
The JSON with problem is that:

[
    {
        "name": "Jason1",
        "age": 20
    },
    {
        "name": "Jason2",
        "age": 40
    },
    {
        "name": "Jason3",
        "age": 60
    }
]

And my codes:

   NSData *jasonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://localhost:3000/all_personal_information.json"]];
    NSDictionary *json = nil;
    if (jasonData) {
        json = [NSJSONSerialization JSONObjectWithData:jasonData options:kNilOptions error:nil];
    }

The code work fine with {"name":"jason","age":20}
and I can get the values by using json[@"name"] and json[@"age"]

But i don’t know how to get the value from the JSON with problem.
I tried to use [json enumerateKeysAndObjectsWithOptions] to transverse the dictionary.
But I will get an error:

enumerateKeysAndObjectsWithOptions:usingBlock:]: unrecognized selector sent to instance 0x89b2490

But I can get the full JSON when I Log the [json description] into console.

  • 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-12T11:26:26+00:00Added an answer on June 12, 2026 at 11:26 am

    Take it in an array.. for example

    NSData *jasonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://localhost:3000/all_personal_information.json"]];
    NSDictionary *json = nil;
    if (jasonData) {
        NSError *e = nil;
    NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:jasonData options:NSJSONReadingMutableContainers error: &e];
    }
    

    the array will contain your

    {
     "name": "Jason1",
     "age": 20
    }
    

    etc in its individual indexes. when u want to get the values in it, you can use this below method to get the values

    NSDictionary *userName = [jsonArray objectAtIndex:1];
    NSString *stringName = [userName valueForKey:@"name"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: To use Wordpress for developing a web application? For instance, I've been
Possible Duplicate: Use Visual Studio web.config transform for debugging I have an asp.net application
Possible Duplicate: Testing use of NSURLConnection with HTTP response error statuses This is bizarre;
Possible Duplicate: Why not use tables for layout in HTML? i know that using
Possible Duplicate: Use DispatcherTimer with Windows Service i want to check for a license
Possible Duplicate: Use javascript variable in object name I am using CKeditor as a
Possible Duplicate: Why use getters and setters? Is there any advantage to making methods
Possible Duplicate: Proper Use of yield return What is the use of the yield
Possible Duplicate: Why use document.write? Considering the negative effects of document.write(), why are most
Possible Duplicate: How to Use setTimeout in a for…loop calling setTimeout with a for

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.