title: iOS JSon parsing, array in array
body: <p>I have a simple json format with an array within an array, but I can't figure out how to get the inner array.  How do I grab the "Commute" tag as an <code>NSArray</code> or a <code>NSDictionary</code>?</p>
  
  <p>Here is my json:</p>
  
  <pre><code>{
      "Language": "EN",
      "Place": [
          {
              "City": "Stockholm",
              "Name": "Slussen",
              "Commute": [
                  "Subway",
                  "Bus"
              ]
          },
          {
              "City": "Gothenburg",
              "Name": "Central station",
              "Commute": [
                  "Train",
                  "Bus"
              ]
          }
      ]
  }
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>NSString *textPath = [[NSBundle mainBundle] pathForResource:@"Places" ofType:@"json"];
  
  NSError *error;
  NSString *content = [NSString stringWithContentsOfFile:textPath encoding:NSUTF8StringEncoding error:&amp;error];  //error checking omitted
  
  NSData *jsonData = [content dataUsingEncoding:NSUTF8StringEncoding];
  
  NSDictionary* json = [NSJSONSerialization
                        JSONObjectWithData:jsonData
                        options:kNilOptions
                        error:&amp;error];
  
  NSArray* AllPlaces = [json objectForKey:@"Place"];
  
  for(int n = 0; n &lt; [AllPlaces count]; n++)
  {
      PlaceItem* item     = [[PlaceItem alloc]init];
      NSDictionary* place = [AllPlaces objectAtIndex:n];
      item.City           = [place objectForKey:@"City"];
      item.Name           = [place objectForKey:@"Name"];
  
      NSDictionary* commutes = [json objectForKey:@"Commute"];
  
      [self.placeArray addObject:(item)];
  }
  </code></pre>