我是 Windows Phone 开发的新手。我想使用 json 解析来解析一些数据。之后
谷歌搜索我找到了一些例子,但我无法正确理解。我有一个链接
http://dotnetbyexample.blogspot.in/2012/01/json-deserialization-with-jsonnet.html
做 json 解析但我无法在我的列表中显示存储、内存、屏幕大小,我的代码是
private void Load_Click(object sender, RoutedEventArgs e)
{
var w = new WebClient();
Observable
.FromEvent<DownloadStringCompletedEventArgs>(w, "DownloadStringCompleted")
.Subscribe(r =>
{
var deserialized =
JsonConvert.DeserializeObject<List<RootObject>>(r.EventArgs.Result);
PhoneList.ItemsSource = deserialized;
});
w.DownloadStringAsync(
new Uri("http://www.schaikweb.net/dotnetbyexample/JSONPhones1.txt"));
}
}
public class Specs
{
public string Storage { get; set; }
public string Memory { get; set; }
public string Screensize { get; set; }
}
public class RootObject
{
public string Brand { get; set; }
public string Type { get; set; }
public Specs Specs { get; set; }
}
}
请帮我解决这个问题或任何其他相同的样本也很感激
谢谢