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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:48:52+00:00 2026-06-08T14:48:52+00:00

I am parsing data from iphone app to json from server but it does

  • 0

I am parsing data from iphone app to json from server but it does not get data from the json

i am using following code

To get Data from json

here is the link of my json data

http://celeritas-solutions.com/emrapp/surveyDescription.php?user_id=ali40

 NSString*user=@"ali40";
 NSString *url=[NSString stringWithFormat:@"http://celeritas-solutions.com/emrapp/surveyDescription.php?user_id=%@",user];
 NSLog(url);
 NSArray *tempArray =[[DataManager staticVersion] startParsing:url];
 for (int i = 0; i<[tempArray count]; i++) {

    id *item = [tempArray objectAtIndex:i];
    NSDictionary *dict = (NSDictionary *) item;
    ObjectData *theObject =[[ObjectData alloc] init];
    [theObject setUser_id:[dict objectForKey:@"user_id"]];
    [theObject setSurvey_id:[dict objectForKey:@"survey_id"]];
    [theObject setSurvey_title:[dict objectForKey:@"survey_Title"]];
    [theObject setSurvey_Description:[dict objectForKey:@"survey_Description"]];    
    [theObject setDate_Created:[dict objectForKey:@"date_Created"]];
    [surveyList addObject:theObject];
    [theObject release];
    theObject=nil;
    int count =[surveyList count];
    NSLog(@"Total is %d",count);

DataManager Class

DataManager *theInstance;

  + (id)staticVersion{

if(!theInstance){
    theInstance = [[DataManager alloc] init];
}
return theInstance;
   }


  - (NSMutableArray *) startParsing:(NSString *)theURLString {

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",theURLString]];
NSString *fileContent= [NSString stringWithContentsOfURL:url];
SBJSON *parser = [[SBJSON alloc] init];  
NSDictionary *data = (NSDictionary *) [parser objectWithString:fileContent error:nil];  
NSArray *items = (NSArray *) data ;  


return items;

    int count=[items count];


    NSLog(@"This is testing %d",count);
    }
  • 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-08T14:48:53+00:00Added an answer on June 8, 2026 at 2:48 pm

    You json is not correct.
    It should be like this:

    {"ali40":[{"user_id":"ali40","survey_id":"1","survey_title":"Resturant Survey","survey_description":"Survey To get feedback from clients about food quality and any suggestion to improve the service","date_created":"2012-07-24 22:39:14","color":"[UIColor GrayColor]"},{"user_id":"ali40","survey_id":"2","survey_title":"Travel Servey","survey_description":"Toursim Survey","date_created":"2012-07-25 00:43:42","color":"[UIColor greyColor]"}]}
    

    This code returns not null result

       NSString*user=@"ali40";
        NSString *url=[NSString stringWithFormat:@"http://celeritas-solutions.com/emrapp/surveyDescription.php?user_id=%@",user];
        NSLog(@"%@",url);
        NSData* data = [NSData dataWithContentsOfURL:
                        [NSURL URLWithString: url]];
        __autoreleasing NSError* error = nil;
        id result = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
        if (error != nil) NSLog(@"%@",error);
        NSLog(@"%@",result);
    

    Output:

    2012-07-26 10:26:22.226 test[2511:f803] (
            {
            color = "[UIColor GrayColor]";
            "date_created" = "2012-07-24 22:39:14";
            "survey_description" = "Survey To get feedback from clients about food quality and any suggestion to improve the service";
            "survey_id" = 1;
            "survey_title" = "Resturant Survey";
            "user_id" = ali40;
        },
            {
            color = "[UIColor greyColor]";
            "date_created" = "2012-07-25 00:43:42";
            "survey_description" = "Toursim Survey";
            "survey_id" = 2;
            "survey_title" = "Travel Servey";
            "user_id" = ali40;
        }
    )
    

    If you json returns many records you need modify your json file

     {"users":[{"user_id":"ali40","survey_id":"1","survey_title":"Resturant Survey","survey_description":"Survey To get feedback from clients about food quality and any suggestion to improve the service","date_created":"2012-07-24 22:39:14","color":"[UIColor GrayColor]"},{"user_id":"ali40","survey_id":"2","survey_title":"Travel Servey","survey_description":"Toursim Survey","date_created":"2012-07-25 00:43:42","color":"[UIColor greyColor]"}]} 
    

    Then you get the array of records:

     NSArray *allItems = [result objectForKey:@"users"];
        for (int i=0; i<allItems.count; ++i) {
            NSDictionary *item = [allItems objectAtIndex:i]; //here you get every user
            NSString *user_id=[item objectForKey:@"user_id"];
            NSLog(@"user_id %@",user_id);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this query to fetch data from webserver onto my iPhone app
I have an iPhone app which communicates with a server to get the data
I am developing an iphone app that needs to parse data received from server.
Possible Duplicates: iPhone: Post data to php page Passing Data From iPhone app to
I am using the Wikitude API in my iPhone app. But while running the
I'm parsing data from a remote database to an iphone application and populating the
my iPhone application should store some data persistantly by using Core Data functionality. Here
Any one has done this, i want to get data parse from the JSON
I'm writing an App that is parsing Data from an XML-Doc on the web.
I am getting data from severs in json format but i want that user

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.