title: ios5 - JSON Parsing - dictionary OK, not parsing to array
body: <p>I am using the new ios5 "NSJSONSerialization" function to obtain some tech-news from a website. I seem to have everything working OK, up until the point when I try to parse the NSDictionary into an NSArray. I have included the code here. The first console test (test 1) is working great - I get a console full of returned json data. But at the second console test (test 2 - the one that checks the contents of the nsarray), gives this message: "Array returned: (null)". Any ideas? Is it because I reused the error variable, maybe? I'm stumped. </p>
  
  <p>Here's the code:</p>
  
  <pre><code>// create the string for making the api call to the website
  NSString* theURL = [NSString stringWithFormat:@"http://pipes.yahoo.com/pipes/pipe.run?_id=9DfJELfJ2xGnjAQWJphxuA&amp;_render=json"];
  
  // declare and assign variables necessary to generate the actual url request
  NSError* err = nil;
  NSURLResponse* response = nil;
  NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init];
  NSURL* URL = [NSURL URLWithString:theURL];
  [request setURL:URL];
  [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
  [request setTimeoutInterval:30];
  
  // make the actual url request - get the data from yahoo pipes, in json format
  NSData* jsonData = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;err];
  
  // assign the entire result to a dictionary
  NSDictionary *resultsDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:&amp;err];
  //*** test 1: use the console to test results:
  NSLog(@"NSDictionary returned: %@",resultsDictionary);
  
  // parse the whole returned list of items (in dictionary form) into a large array   
  NSArray* arrayOfReturnedItems = [resultsDictionary objectForKey:@"items"];  
  
  //*** test 2: view the items returned (in the console)
  NSLog(@"Array returned: %@",[arrayOfReturnedItems objectAtIndex:0]);
  </code></pre>