private static string FetchJson(string url) { var data = new randomuser(); string json = ""; try { using (WebClient wc = new WebClient()) { json = wc.DownloadString(url); } } catch (Exception) { // throw; } return(json); }
private static randomuser FetchJson(string url) { var data = new randomuser(); try { using (WebClient wc = new WebClient()) { string json = wc.DownloadString(url); data = Newtonsoft.Json.JsonConvert.DeserializeObject <randomuser>(json); } } catch (Exception ex) { // throw; } return(data); }