I am trying to import a JSON array and convert it to an NSArray for a UITableView, but can't work out how to grab the data.
My JSON is formatted as so when I use curl:
[{"location_name":"??"},{"location_name":"105"},{"location_name":"106"},{"location_name":"106A"},{"location_name":"106b"},{"location_name":"107"},{"location_name":"108"},{"location_name":"109"},{"location_name":"110"},{"location_name":"111"},{"location_name":"112"},{"location_name":"113"},{"location_name":"114"}]
My xCode code is as follows:
// Parse out the JSON data
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&jsonError];
NSString* location_name = [json objectForKey:@"location_name"];
NSLog(@"Location Name: %@", location_name);
But in my console output I only get: "Location Name: (null)"
jsonErrorvariable? That might give you some hints as to what is going on.Location Name: (null)