I am trying to deserialize json and clearly it's not going well since I'm here. I'm not only looking for help to make it work but also some link where it's explained how it works because I couldn't find one and I want to learn.
var json = w.DownloadString(url);
var data = JsonConvert.DeserializeObject<Rates[]>(json);
Json looks like this:
{
"info":"text",
"sub":"text",
"data":[
{
"date":20181111,
"exchange":"New York",
"open":1000.43,
"high":1239.91,
"low":1231.41
},
{
"date":20181111,
"exchange":"New York",
"open":1000.43,
"high":1239.91,
"low":1231.41
}
]
}
I have these classes:
public class Rates
{
public List<Data> data { get; set; }
}
public class Data
{
public int date { get; set; }
public string exchange { get; set; }
public double open { get; set; }
public double high { get; set; }
public double low { get; set; }
}
public class RootObject
{
public string info { get; set; }
public string sub { get; set; }
public List<Data> data { get; set; }
}
}