private static WikiPerson GetPersonFromJsonElement(JsonElement item) { int id = 0; if (item.TryGetProperty("item", out JsonElement itemId)) { int.TryParse(itemId.GetProperty("value").ToString().Substring(32), out id); } var name = String.Empty; if (item.TryGetProperty("itemLabel", out JsonElement itemLabel)) { name = itemLabel.GetProperty("value").ToString(); } var description = String.Empty; if (item.TryGetProperty("itemDescription", out JsonElement itemDescription)) { description = itemDescription.GetProperty("value").ToString(); } DateTime birthday = DateTime.MinValue; if (item.TryGetProperty("DR", out JsonElement DR)) { DateTime.TryParse(DR.GetProperty("value").ToString(), out birthday); } DateTime death = DateTime.MinValue; if (item.TryGetProperty("RIP", out JsonElement RIP)) { DateTime.TryParse(RIP.GetProperty("value").ToString(), out death); } var image = string.Empty; if (item.TryGetProperty("image", out JsonElement imageE)) { image = imageE.GetProperty("value").ToString(); } var link = String.Empty; if (item.TryGetProperty("article", out JsonElement article)) { link = article.GetProperty("value").ToString(); } var person = new WikiPerson { Id = id, Name = name, Description = description, Birthday = birthday, Death = death, Image = image, Link = link, //Rating = rating }; return(person); }