title: Unable to parse json with Alamofire
body: <p>I have used Alamofire before but had no problems, looks like this time my json is a little bit weird, I can not find a way to pass it.<br>
  This is how my json looks like, I have simplified it but context is the same:</p>
  <pre><code>    {
          &quot;categories&quot;: [
              {
                  &quot;categories&quot;: {
                      &quot;id&quot;: 1,
                      &quot;name&quot;: &quot;A&quot;
                  }
              },
              {
                  &quot;categories&quot;: {
                      &quot;id&quot;: 2,
                      &quot;name&quot;: &quot;B&quot;
                  }
              },
              {
                  &quot;categories&quot;: {
                      &quot;id&quot;: 3,
                      &quot;name&quot;: &quot;C&quot;
                  }
              }]
  }
  </code></pre>
  <p>Also, I have a <code>Category</code> structure like this:</p>
  <pre><code>struct Category {
      let id: Int
      let name: String
      
      init(id: Int, name: String) {
          self.id = id
          self.name = name
      }
  }
  </code></pre>
  <p>And finally, my <code>Alamofire request</code> :</p>
  <pre><code>func getCategories(completed: @escaping () -&gt; ()) {
          let baseUrl = &quot;&quot;
          
          let api_key = &quot;&quot;
          
          let headers : HTTPHeaders = [
              &quot;user-key&quot;:api_key
          ]
          
          Alamofire.request(baseUrl, method: .get, parameters: nil, headers: headers).responseJSON { response in
              
              guard let value = response.value as? [String:Any] else { return }
              guard let cats = value[&quot;categories&quot;] as? [Category] else { return}
              print(cats)
              
              completed()
          }
      }
  </code></pre>
  <p><code>Problem</code> - I have printed a value and it works fine, but this <code>print(cats)</code> never gets called because of the line before, it returns.<br>
  Looks like I have a problem with models and parsing, cannot figure out why.</p>