Я пытаюсь получить данные COVID-19 с помощью API, но у меня есть проблема, подобная этой
Вот мой код:
var deserial = new JsonDeserializer();
var client = new RestClient("https://api.thevirustracker.com/free-api?countryTotals=ALL");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
var response = client.Execute(request);
var output = deserial.Deserialize<Dictionary<string, string>>(response);
var data = output["countryitems"];
var allData = JsonConvert.DeserializeObject<List<CountryItemViewModel>>(data);
Моя CountryItemViewModel:
public class CountryItemModelView
{
[JsonProperty("ourid")]
public long Ourid { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("source")]
public Uri Source { get; set; }
[JsonProperty("total_cases")]
public long TotalCases { get; set; }
[JsonProperty("total_recovered")]
public long TotalRecovered { get; set; }
[JsonProperty("total_unresolved")]
public long TotalUnresolved { get; set; }
[JsonProperty("total_deaths")]
public long TotalDeaths { get; set; }
[JsonProperty("total_new_cases_today")]
public long TotalNewCasesToday { get; set; }
[JsonProperty("total_new_deaths_today")]
public long TotalNewDeathsToday { get; set; }
[JsonProperty("total_active_cases")]
public long TotalActiveCases { get; set; }
[JsonProperty("total_serious_cases")]
public long TotalSeriousCases { get; set; }
}
Я могу принять необходимую часть, но не могу принести остальное.