我試圖解析一個Json。我已經成功地將Json傳遞給字符串,但是我無法將其轉換爲JObject。這是我嘗試代碼:無法解析Windows Phone中的JSON
private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
string jsonStr = e.Result;
if (!string.IsNullOrEmpty(jsonStr))
{
JObject objects = JObject.Parse(jsonStr); // this is when the error came at the first time. It says: An exception of type 'Newtonsoft.Json.JsonReaderException' occured in Newtonsoft.Json.DLL but was not handled in user code.
JArray a = (JArray)objects[""];
IList<Feeds.Topic> listFeeds = a.ToObject<IList<Feeds.Topic>>();
this.DataContext = listFeeds;
}
}
我感謝您的幫助,如果你能幫助我,謝謝:)
感謝,這是非常有幫助,我:) –