public JsonResult GetWeather(string city) { var url = "https://api.openweathermap.org/data/2.5/weather?q=" + city + "&APPID=" + _apiKey + "&units=metric"; //Try catch for invalid City name which not equals with any city try { var content = client.DownloadString(url); var returnValue = Json(jsonEditor.Deserializer(content), JsonRequestBehavior.AllowGet); return(returnValue); } catch (Exception) { return(null); } }