public string GetWeatherForFiveDays(string city) { //GET JSON FILE AND CONVERT IT var url = $"https://api.openweathermap.org/data/2.5/forecast?q={city}&APPID={_apiKey}&units=metric"; //Try catch for invalid City name which not equals with any city try { var content = client.DownloadString(url); Rootobject weatherJsonData = new JavaScriptSerializer().Deserialize <Rootobject>(content); //Get selected values and return it to page var selectedWeatherData = new JavaScriptSerializer() .Serialize(jsonEditor.SelectWeatherDetails(weatherJsonData)); return(selectedWeatherData); } catch (Exception) { return(null); } }