Skip to content

Instantly share code, notes, and snippets.

@edwardinubuntu
Created November 5, 2014 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardinubuntu/5778172308a0126b589a to your computer and use it in GitHub Desktop.
Save edwardinubuntu/5778172308a0126b589a to your computer and use it in GitHub Desktop.
Parsing open gov data from array
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (!connectionError) {
NSError *error = nil;
NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
if (!error) {
for (NSDictionary *eachPark in jsonArray) {
NSString *title = [eachPark objectForKey:@"stitle"];
NSString *body = [eachPark objectForKey:@"xbody"];
NSLog(@"Park info: %@, %@", title, body);
}
} else {
NSLog(@"Error with: %@", error);
}
} else {
NSLog(@"Connection with: %@", connectionError);
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment