My code:
NSString *jsonString;
jsonString = [[NSMutableString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
// Create a dictionary from the JSON string
NSDictionary *results = [jsonString JSONValue];
NSLog(@"%@",jsonString);
// Build an array from the dictionary for easy access to each entry
NSArray *places = [results objectForKey:@"description"];
I am not getting the result i wanted.
When I debug the code I am getting 2 key/value pair & 0 object for NSArray places.
It is correct that you have 2 key/value pairs. The top two keys intact are “predictions” and “status”. So you must first of all extract predictions (it’s an array):
and then iterate over it; also note that “description” is a string and to get the places you must split it using the “,” separator: