Getting JSON data from an HTTP response using conditional binding
To answer your explicit question with what is probably an obvious answer... Wrap it up in a function.

func debugSerialize(data: NSData) -&gt; AnyObject? {
    let jsonData = try? NSJSONSerialization.JSONObjectWithData(data, options: [])
    if(jsonData == nil) {
        print("Could not parse data")
    }
    return jsonData
}


Another option would be to let NSJSONSerialization.JSONObjectWithDatas thrown error propagate up the stack and have a centralized place to catch them and put the print there... Unless you are married to the idea that the rest of your code must run even if jsonData is nil...

Keep in mind that most of the code you have posted does nothing but print debug output. Once the debugging is complete all of that code can, and should, be removed (don't leave a bunch of debugging print statements in production code.) Once you do that, you will see that all your code really does is check to see of the JSON deserialization created a ReturnType object.

Likely, you need this code to do more than produce debug output on bad server responses, but I'm not able to review hypothetical code that you could have written.