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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:55:27+00:00 2026-05-27T12:55:27+00:00

i am using the below json method and following code to parse json method

  • 0

i am using the below json method and following code to parse json method and display the data which i need on a label.
i followed this link http://www.touch-code-magazine.com/tutorial-fetch-and-parse-json/ and many other but i am not getting the result what i need.Either it throws exception in below code line or else it displays null value.

NSDictionary* profile = [profileinfo objectAtIndex:0]; //throws exception

can anyone help me what is wrong in the below code and what is missing so tat i get the values i.e, phonenumber,firstname and other data from json method.

//Json Method

{

"createdBy":"superadmin",
"createdOn":"2011-11-15T00:49:06+05:30",
"updatedBy":"superadmin",
"updatedOn":"2011-11-15T00:49:06+05:30",
"contactNumber":"9945614074",
"emailNotification":"true",
"firstName":"resident2",
"lastName":"user5",
"loginId":"jin",
"married":"false",
"message":"",
"preferredLanguage":"ko_KR",
"sex":"0",
"smsNotification":"false",
"status":"ACTIVE",
"subscribedPlans":"Intelligent Concierge",
"userName":"Cisco"

}

//code

- (void)loadData

{

 dataWebService = [[NSMutableData data] retain];


NSURLRequest *request = [[NSURLRequest requestWithURL:[NSURL URLWithString:@"URL LINK"]]retain];  

[[NSURLConnection alloc]initWithRequest:request delegate:self];

}


-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{


[connection release];    
NSString *responseString = [[NSString alloc] initWithData:dataWebService encoding:NSUTF8StringEncoding];

self.dataWebService = nil;

NSArray* profileinfo = [(NSDictionary*) [responseString JSONValue] objectForKey:@"createdBy"]; 
[responseString release];    

NSDictionary* profile = [profileinfo objectAtIndex:0];

//fetch the data
NSNumber* numb = [profile objectForKey:@"contactNumber"];

NSString* name = [profile objectForKey:@"firstName"];

//set the text to the label
label.numberOfLines = 0;
label.text = [NSString stringWithFormat:@"contactNumber: %@ \n \n Name:  %@ \n \n",
             numb,name];

}
  • 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-27T12:55:27+00:00Added an answer on May 27, 2026 at 12:55 pm

    The jsonValue is your dictionary.

    replace

    NSArray* profileinfo = [(NSDictionary*) [responseString JSONValue] objectForKey:@"createdBy"]; 
    

    and

    NSDictionary* profile = [profileinfo objectAtIndex:0];
    

    with

    NSDictionary * profile =  (NSDictionary*)[responseString JSONValue];
    

    and now use objectForKey to get your values

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

Sidebar

Related Questions

using the below code for decoding json $categories = json_decode($data); $categories = $categories->data; where
Currently i'm using below code which works well. $(#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel).hide(); any optimised code?
I'm retrieving some data from Twitter using the code below Dim FilterData = follow=13,15
I am using the below method between the 50lines of JQuery Code. From the
Hi all i am using json to pass data in wcf service. Below is
i am using below code to change the the font type of text view.
I am using below code to create a reminder in Google calendar (using Google
I have a class that I am using below. And I am using this
In past, I am using Listview and using below code can show a particular
I want to enable auto update script in flex3. i am using below code

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.