       return
     }
 
-    if response.statusCode != 200 {
-      print("GooglePlaces Error: Invalid status code \(response.statusCode) from API")
-      let error = NSError(domain: ErrorDomain, code: response.statusCode, userInfo: [NSLocalizedDescriptionKey:"Invalid status code"])
+    let httpResponse = response as! HTTPURLResponse
+    
+    
+    if httpResponse.statusCode != 200 {
+      print("GooglePlaces Error: Invalid status code \(httpResponse.statusCode) from API")
+      let error = NSError(domain: ErrorDomain, code: httpResponse.statusCode, userInfo: [NSLocalizedDescriptionKey:"Invalid status code"])
       done(nil,error)
       return
     }
     
     let json: NSDictionary?
     do {
-      json = try NSJSONSerialization.JSONObjectWithData(
-        data,
-        options: NSJSONReadingOptions.MutableContainers) as? NSDictionary
+      json = try JSONSerialization.jsonObject(
+        with: data!,
+        options: JSONSerialization.ReadingOptions.mutableContainers) as? NSDictionary
     } catch {
       print("Serialisation error")
       let serialisationError = NSError(domain: ErrorDomain, code: 1002, userInfo: [NSLocalizedDescriptionKey:"Serialization error"])

        let northEastDict = viewport["northeast"] as! [String: AnyObject]
        let northEast = CLLocation(latitude: northEastDict["lat"] as! Double, longitude: northEastDict["lng"] as! Double)

        radius = self.location.distanceFromLocation(northEast)
    }
    
    

      }
    }
    
    
    
    done(json as? [String:Any],nil)

  }
}
