I have a JSON array that is being output to a page. I would like to convert this JSON array to NSArray.
This is the JSON output on the web page:
[{"city":"Current Location"},{"city":"Anaheim, CA"},{"city":"Los Angeles, CA"},{"city":"San Diego, CA"},{"city":"San Francisco, CA"},{"city":"Indianapolis, IN"}]
This is my call to NSURL and NSJSONSerialization:
NSString *cityArrayURL = [NSString stringWithFormat:@"http://site/page.php"; NSData *cityData = [NSData dataWithContentsOfURL:[NSURL URLWithString:cityArrayURL]]; NSError *error; NSDictionary *cityJSON = [NSJSONSerialization JSONObjectWithData:cityData options:kNilOptions error:&error];
I would like to turn an NSDictionary named cityJSON into an NSArray. Can someone tell me what the next step can take? Thanks!
source share