title: Could not cast value of type '__NSCFArray' to 'NSDictionary' + displaying annotations in a map view
body: <p>I really need help with an issue I'm getting when trying to parse a JSON that looks like this:
  <a href="http://imgur.com/t39nUSv" rel="nofollow">http://imgur.com/t39nUSv</a>
  It's an array '[]' of dictionaries '{}', each dictionary have two key/value pairs, as seen in the picture.
  This is my code, and I don't know why it crashes on line</p>
  
  <pre><code>for location in JSON as! Dictionary&lt;String, AnyObject&gt;
  </code></pre>
  
  <p>Here is the code that's making it crash</p>
  
  <pre><code>func populateMapObjects() {
  
      if populatingMapObjects {
          return
      }
  
      populatingMapObjects = true
  
      self.loadingIndicator.startAnimating()
  
      Alamofire.request(GWNetworking.Router.MapObjects).responseJSON() { response in
          if let JSON = response.result.value {
  
              dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)) {
  
                  if (JSON .isKindOfClass(NSArray)) {
  
  
                      for location in JSON as! Dictionary&lt;String,AnyObject&gt; {
  
                          if let issueLocation: IssueLocation = IssueLocation(locationName: "Center of the universe", campusName: "Queen's University", latitude: 44.22661586877309, longitude: -76.49380087852478, coordinate: CLLocationCoordinate2D(latitude: 44.22661586877309, longitude: -76.49380087852478)) {
  
                              var index = 0
  
                              if let locationName = JSON[index]["name"] as? String {
                                  issueLocation.locationName = locationName
                              }
  
                              print(issueLocation.locationName)
  
                              if let latitude = JSON[index]["coordinates"]!![1] as? Double {
                                  issueLocation.latitude = latitude
                              }
  
                              if let longitude = JSON[index]["coordinates"]!![0] as? Double {
                                  issueLocation.longitude = longitude
                              }
  
                              issueLocation.coordinate = CLLocationCoordinate2D(latitude: issueLocation.latitude, longitude: issueLocation.longitude)
  
                              index++
  
                              self.mapObjects.addObject(issueLocation)
                      }
                  }
              }
  
                  dispatch_async(dispatch_get_main_queue()) {
  
                      self.loadingIndicator.stopAnimating()
                      self.populatingMapObjects = false
              }
          }
      }
  }
  }
  </code></pre>
  
  <p>I'm really confused regarding whether or not I should consider each "layer" of the JSON as an array or a dictionary, and if it should be NSDictionary, Dictionary.. and if I should use indexes or valueForKey.... I'm lost. Someone please tell me how to fix this bug.
  I'm using the same API for other parts of the app but this view in particular gets a JSON that looks different, which is why I'm having trouble getting my code to work.</p>
  
  <p><strong>EDIT 1: Code that adds the annotations to the map view.</strong></p>
  
  <pre><code>    func loadObjectsIntoMapView() {
  
      for mapObject in mapObjects {
  
          let temporaryMapAnnotation = IssueLocation(locationName: mapObject.locationName, campusName: "Main Campus", latitude: mapObject.latitude, longitude: mapObject.longitude, coordinate: mapObject.coordinate)
  
          if (temporaryMapAnnotation.longitude &lt; -76.50921821594238) {
              temporaryMapAnnotation.campusName = "West Campus"
          }
  
          self.mapView.addAnnotation(temporaryMapAnnotation)
      }
  
  }
  </code></pre>