我正在製作一個windows phone應用程序,它可以從此鏈接使用json http://dir.yummly.com/4/public/8a753a70358c827b01358da787bd68f3,但是當我嘗試異步下載數據時,我無法以可讀語言獲取e.result。 這裏是我的C#代碼 -在Windows Phone 7中使用json webservice
Uri sub4 = new Uri("http://dir.yummly.com/4/public/8a753a70358c827b01358da787bd68f3");
string kit = sub4.ToString();
WebClient w = new WebClient();
w.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
w.DownloadStringAsync(sub4);
MessageBox.Show("done");
}
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
string fres = e.Result;// here e.result was �
}
然後,我想反序列化e.result。 我的代碼適用於其他任何json網址。而且,因爲我正在開發Windows Phone應用程序,所以我無法使用其他webcilent方法,例如DownloadData和DownloadString。我也看到了utf8和unicode之間的很多轉換,但沒有一個能夠工作。任何人都可以請幫忙?
非常感謝你,先生。你很棒..!!對於那些有同樣問題的人可以參考這個鏈接 - http://dotnetbyexample.blogspot.in/2012/01/json-deserialization-with-jsonnet.html – user1673567