Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You json is not correct. It should be like this:</p> <pre><code>{"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]"}]} </code></pre> <p>This code returns not null result</p> <pre><code> 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:&amp;error]; if (error != nil) NSLog(@"%@",error); NSLog(@"%@",result); </code></pre> <p>Output:</p> <pre><code>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; } ) </code></pre> <p>If you json returns many records you need modify your json file</p> <pre><code> {"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]"}]} </code></pre> <p>Then you get the array of records:</p> <pre><code> NSArray *allItems = [result objectForKey:@"users"]; for (int i=0; i&lt;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); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload