I have the following JSON data:
[{"id":"value","first_name":"value","last_name":"value"},
{"id":"value","first_name":"value","last_name":"value"},
{"id":"value","first_name":"","last_name":""}]
Then I implement my code :
NSError *err;
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://abcd.com/index.php?r=WS/Employee"]];
NSData *dataFromUrl = [NSData dataWithContentsOfURL:url];
NSMutableArray *array = [NSJSONSerialization JSONObjectWithData:dataFromUrl options: NSJSONReadingMutableContainers error:&err];
if (err)
NSLog(@"JSONObjectWithData error: %@", err);
For which, I get the following error message:
JSONObjectWithData error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x9c900f0 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
Please help me to get those data.