title: Manually Parsing a a JSON into an Object of a Struct
body: <p>I'm a beginner in swift and I'm currently making an app that makes a web request. I've been trying to parse this JSON Data but the nested data is just really hard to wrap my head around:</p>
  
  <pre><code> "abilities": [
              {
                  "ability": {
                      "name": "chlorophyll",
                      "url": "https://pokeapi.co/api/v2/ability/34/"
                  },
                  "is_hidden": true,
                  "slot": 3
              },
              {
                  "ability": {
                      "name": "overgrow",
                      "url": "https://pokeapi.co/api/v2/ability/65/"
                  },
                  "is_hidden": false,
                  "slot": 1
              }
          ]
  </code></pre>
  
  <p>JSon Serialization Code</p>
  
  <pre><code>let jsonAny = try JSONSerialization.jsonObject(with: data, options: [])
              guard let json = jsonAny as? [String: Any] else { return }
  </code></pre>
  
  <p>This is my attempt to manually parse the JSON Data</p>
  
  <pre><code>    private func parsePokemonManual(json: [String: Any]) -&gt; Pokemon {
          let abilities = json["abilities"] as? [String: Any] ?? [String: Any]()
  
          return Pokemon(abilities: abilities)
      }
  }
  </code></pre>
  
  <p>These are the structs that I made to hold the data.</p>
  
  <pre><code>struct Abilities {
      let ability : Ability
  
      struct Ability {
          let name : String
      }
  }
  </code></pre>
  
  <p>How do I successfully parse the JSON Data into an object of Pokemon structure?</p>
  
  <p>With this code so fat I am getting the error "Cannot convert the value of type '[String : Any]' to expected argument type '[Abilities]'. My problem is that I don't know what type to cast the abilities as and that my struct 'Abilities' is also incorrect. </p>