私はjsonファイルを持っています:
[
{
"as_of":"2012-08-31T15:31:55Z",
"trends":[
{
"name":"#GDTHATXX",
},
{
"name":"#UnMundoEnElQue",
}
],
"created_at":"2012-08-31T15:30:32Z",
"locations":[
{
"name":"Globales",
"woeid":1
}
]
}
]
そして生成されたクラス:
public class Trend
{
public string name { get; set; }
}
public class Location
{
public string name { get; set; }
public int woeid { get; set; }
}
public class RootObject
{
public string as_of { get; set; }
public List<Trend> trends { get; set; }
public string created_at { get; set; }
public List<Location> locations { get; set; }
}
次のように、RootObject の要素を逆シリアル化できます。
List<RootObject> values = JsonConvert.DeserializeObject<List<RootObject>>(Text);
lvMain3.ItemsSource = values;
しかし、「傾向」または「場所」から要素をどのように逆シリアル化できますか。助けてくれてありがとう!