title: Trying to Parse JSON in swift but not working
body: <p>I'm trying to parse some JSON, this is what it's returning when I directly go to the URL:</p>
  
  <pre><code>[{"Password":"whatever1"}]
  </code></pre>
  
  <p>My code is able to receive the data correctly (when I debugged the variable "data" had the above JSON) however when trying to Parse it, it won't work. I think it might have to do with the square brackets, cause I've been parsing other JSONs without the square brackets and it works well.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>func SignIn (username: String, password: String, completion: @escaping (Bool)-&gt;())
  {
      let url = URL(string: "http://&lt;myIP&gt;/API/SignIn.php?username=\(username)");
  
      let task = URLSession.shared.dataTask(with: url!)
      { (data, response, error) in
          if let data = data
          {
              do
              {
                  // Convert the data to JSON
                  let jsonSerialized = try JSONSerialization.jsonObject(with: data, options: []) as? [String : Any]
  
                //  print( jsonSerialized)
                  if let json = jsonSerialized, let result = json["Password"]
                  {
                      print(result)
                      if (String(describing: result) == password)
                      {
                          completion(true)
                      }
                      else
                      {
                          completion(false)
                      }
                      // TODO: password is wrong,
                      // TODO: username is wrong
                      // TODO: else if timeout
                  }
              }
              catch let error as NSError {
                  print(error.localizedDescription)
                  completion(false)
              }
          }
          else if let error = error
          {
              print(error.localizedDescription)
              completion(false)
          }
      }
      task.resume()
  
  }
  </code></pre>