I am trying to parse a JSON string from a web service. The line that appears is as follows:
{ "Faculty_Members": [ { "ID": 3377, "First_Name": "John", "Last_Name": "Doe" } ] }
My iOS code is as follows:
NSURL *jsonUrl = [NSURL URLWithString:@"http://website/Service1.svc/Names"]; NSError *error = nil; NSData *jsonData = [NSData dataWithContentsOfURL:jsonUrl options:kNilOptions error:&error]; NSMutableDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&error]; NSLog(@"%@",jsonResponse);
The correct JSON data will be displayed in the log, but I keep getting "NOPE" in isValidJsonObject.
The web service sends the data back as a string data type. Does it matter? If so, what type of data should I send?
Any ideas would be much appreciated!
source share