title: Cannot type cast or parse through data returned from POST request
body: <p>I'm working on a project where I'm using a POST request to get JSON data returned from an AWS server that my teammate set up.This is what my code looks like - pretty standard.</p>
  
  <pre><code>let task : URLSessionDataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) in
                  if let data = data {
                      if let response = try! JSONSerialization.jsonObject(
                      with: data, options: []) as? [String: Any] {
  
                      let zones = response["body"]! as? [[String: Any]] ?? []
  </code></pre>
  
  <p>The JSON that gets returned looks like this</p>
  
  <p><a href="https://i.stack.imgur.com/jCnQG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jCnQG.png" alt="enter image description here"></a></p>
  
  <p>The content of "zones" isn't important here. What I want is the zones array, but it comes wrapped in this thing called "body" (my backend guy says that's just how AWS sends it over by default so it's not something he can change). The problem I'm having is the line I currently have that's supposed to get the zones array (<code>let zones = response["body"]! as? [[String: Any]] ?? []</code>) always gives me the empty array (and without <code>?? []</code> it gives me nil). If I get rid of the type casting, I get the zones array but it's of type <code>Any</code>, so I can't parse through it the way I want to. Any ideas on how to get the zones array as an array so I can parse it?</p>