I'm trying to deserialize json data but for some reason it always returns zero values. I have tried different ways but I'm not able to fetch that value
var result = JsonConvert.DeserializeObject<Tickers>(json);
foreach (Rates rate in result)
{
Console.WriteLine(rate.EUR);
}
Json looks like this:
[
{
"base":"USD",
"date":"2018-06-12",
"rates":{
"NZD":1.4053046000828844,
"EUR":0.8288437629506838
//plus many more
}
}
]
And I have these classes:
public class Tickers
{
public string baseCurrency { get; set; }
public string date { get; set; }
public List<Rates> tickers { get; set; }
}
public class Rates
{
public double NZD { get; set; }
public double EUR { get; set; }
//etc
}
public partial class RootObject
{
public string @base { get; set; }
public string date { get; set; }
public List<Rates> rates { get; set; }
}