title: Swift trouble parsing JSON: Could not cast value of type '__NSCFDictionary' to 'NSArray' error
body: <p>I'm very new to iOS development and I have a problem to parse JSON response from an API.</p>
  
  <p>Here is how my sample JSON looks like: </p>
  
  <pre><code>{
  "recipe":{
  "publisher":"Real Simple",
  "f2f_url":"http://food2fork.com/view/39999",
  "ingredients":[
      "1 tablespoon olive oil",
      "1 red onion, chopped",
      "2 small yellow squash, cut into 1/2-inch pieces",
      "2 cloves garlic, chopped",
      "1 jalapeo, seeded and thinly sliced",
      "1 kosher salt and black pepper",
      "4 28-ounce can diced tomatoes\n"
  ],
  "source_url":"http://www.realsimple.com/food-recipes/browse-all-recipes/halibut-spicy-squash-tomatoes-00000000006842/index.html",   
  "recipe_id":"39999", "image_url":"http://static.food2fork.com/someurl.jpg",
    "social_rank":95.14721536803285,
    "publisher_url":"http://realsimple.com",
    "title":"Halibut With Spicy Squash and Tomatoes"
    }
  }
  </code></pre>
  
  <p>and when I print JSON (another one in this example) it looks like this:</p>
  
  <pre><code>["recipe": {
      "f2f_url" = "http://food2fork.com/view/20970";
      "image_url" = "http://static.food2fork.com/98113574b0.jpg";
      ingredients =     (
      "1 (170 gram) can crabmeat",
      "125 grams PHILADELPHIA Light Brick Cream Cheese Spread, softened",
      "2 green onions, thinly sliced",
      "1/4 cup MIRACLE WHIP Calorie-Wise Dressing",
      "12 wonton wrappers"
    );
      publisher = "All Recipes";
      "publisher_url" = "http://allrecipes.com";
      "recipe_id" = 20970;
      "social_rank" = "41.83825995815504";
      "source_url" = "http://allrecipes.com/Recipe/Philly-Baked-Crab-Rangoon/Detail.aspx";
      title = "PHILLY Baked Crab Rangoon";
  }]
  </code></pre>
  
  <p>I have an object Recipe and it looks like this:</p>
  
  <pre><code>class Recipe {
    struct Keys {
        static let Title = "title"
        static let ImageUrl = "image_url"
        static let Ingredients = "ingredients"
        static let RecipeId = "recipe_id"
    }
  
    var title : String? = nil
    var id = 0
    var imageUrl : String? = nil
    var ingredients : String? = nil
  
    init(dictionary : NSDictionary) {
        self.title = dictionary[Keys.Title] as? String
        self.id = dictionary[RecipeDB.Keys.ID] as! Int
        self.imageUrl = dictionary[Keys.ImageUrl] as? String
        self.ingredients = dictionary[Keys.Ingredients] as? String
      }
  }
  </code></pre>
  
  <p>and when I try to parse JSON and cast it to a dictionary I get a <code>Could not cast value of type '__NSCFDictionary' to 'NSArray'</code> error</p>
  
  <p>here is my method that cast response to a dictionary and causes error</p>
  
  <pre><code>func recipiesFromData(data: NSData) -&gt; [Recipe] {
  
      var dictionary : [String : AnyObject]!
  
      dictionary = (try! NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments)) 
    as! [String : AnyObject]
  
      let recipeDictionaries = dictionary["recipe"] as! [[String : AnyObject]]
  
      let recipies = recipeDictionaries.map() { Recipe(dictionary: $0) }
  
      return recipies
  }
  </code></pre>
  
  <p>Thanks.</p>