     
     func cancel() { }
     }
+
+public protocol NSJSONConvertible: AnyObject { }
+extension NSDictionary: NSJSONConvertible { }
+extension NSArray:      NSJSONConvertible { }


    public func request(
            method:          Alamofire.Method,
            json:            AnyObject,
            requestMutation: NSMutableURLRequest -> () = { _ in })
        -> Request
        {
        if(!NSJSONSerialization.isValidJSONObject(json))
            {
            return FailedRequest(
                Resource.Error(userMessage: "Cannot encode JSON", debugMessage: "Not a valid JSON object"))

            }
        catch
            {
            // This catch block should obviate the isValidJSONObject() call above, but Swift apparently
            // doesn’t catch NSInvalidArgumentException (radar 21913397).
            return FailedRequest(
                Resource.Error(userMessage: "Cannot encode JSON", error: error as NSError))
            }
