title: NSDictionary objectForKey return value
body: <p>I'm using json-framework to create a NSDictionary out of a JSON response. That much works wonderfully.</p>
  
  <p>Now, within this JSON payload are one or more objects - let's call them X. Sort of like this in XML:</p>
  
  <pre><code>&lt;OBJECTS&gt;
    &lt;X&gt;
      ...
    &lt;/x&gt;
    &lt;X&gt;
      ...
    &lt;/X&gt;
    &lt;X&gt;
      ...
    &lt;/X&gt;
  &lt;/OBJECTS&gt;
  </code></pre>
  
  <p>When I look in the aforementioned NSDictionary object for all Xs, like so:</p>
  
  <pre><code>NSDictionary *results = [[dict objectForKey:@"OBJECTS"] objectForKey:@"X"];
  </code></pre>
  
  <p>Or even:</p>
  
  <pre><code>NSDictionary *results = [dict valueForKeyPath:@"OBJECTS.X"];
  </code></pre>
  
  <p>I get, according to gdb, a <strong>NSCFArray</strong> of NSDictionary objects. (Yes, I smell something funny here too, but more on this in a moment.)</p>
  
  <p>When there is only <em>one</em> object named X, I get back an honest-to-goodness NSDictionary.</p>
  
  <p>So ... what should I do to make this behave consistently, no matter how many Xs there are?</p>
  
  <p>At first glance, I'd think I just change results to be <strong>NSArray *</strong>, but what happens when I want to fast enumerate over the results? Right now I do this:</p>
  
  <pre><code>for (NSDictionary *result in results)
  </code></pre>
  
  <p>In the NSCFArray case (multiple Xs), I get back an individual NSDictionary for each X. In the single X case, I get back the one NSDictionary, except now my perspective is one level too deep. In other words, instead of this (contrived example):</p>
  
  <pre><code>(gdb) po results
  &lt;NSCFArray 0xd4a940&gt;(
  {
      foo =     {
          bar = "something";
      };
  }
  {
      foo =     {
          bar = "something else";
      };
  }
  )
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>(gdb) po results
  {
      foo =     {
          bar = "something";
      };
  }
  </code></pre>
  
  <p>Clues welcome/appreciated! You may even ask if it's necessary to have to break this apart at all, but for now let's suppose this trip is really necessary. (Still, I'm happy to be persuaded otherwise, if someone feels strongly enough about it.)</p>
  
  <p>Ultimately, at the end of the day, I want to have a NSArray of NSDictionary objects.</p>