Cannot convert JSON Data in Swift 3
<p>I'm converting a project from Obj-c to Swift 3 and I can't get it to read JSON responses from our web methods. As far as I can see, the code looks like a good conversion from it's Obj-c counterpart, but the JSONSerilaization is having trouble. </p>

<p>I would post the old Obj-c, but it's spread across several NSURLConnection delegate methods. I can post this if required?</p>

<p>Swift 3:</p>

<pre><code>// Set up the URL request
    var getString : String = "https://TheWebMethod"

    guard let url = URL(string: getString) else {
        print("Error: cannot create URL")
        return
    }
    let urlRequest = URLRequest(url: url)

    // set up the session
    let config = URLSessionConfiguration.default
    let session = URLSession(configuration: config)

    // make the request
    let task = session.dataTask(with: urlRequest) {
        (data, response, error) in
        // check for any errors
        guard error == nil else {
            print("error calling GET on Method")
            print(error)
            return
        }
        // make sure we got data
        guard let responseData = data else {
            print("Error: did not receive data")
            return
        }
        // parse the result as JSON, since that's what the API provides
        do {

            guard let result = try JSONSerialization.jsonObject(with: responseData, options: []) as? [String: AnyObject] else {
                print("error trying to convert data to JSON")
                return
            }

            print("The result is: " + result.description)

            guard let resultTitle = result["title"] as? String else {
                print("Could not get title from JSON")
                return
            }
            print("The title is: " + resultTitle)
        } catch  {
            print("error trying to convert data to JSON")
            return
        }
    }

    task.resume()
</code></pre>

<p>Example JSON output when run through browser:</p>

<pre><code>[{"id":"3","Initials":"TL","FullName":"Tony Law","LoginName":"test","Password":"password","EmailAddress":"myemailaddress","MobileTelNo":"0123456789","SecToken":"Secret"}]
</code></pre>