I have problem deserialize string with JSON.Net on WP7. I have this JSON string:
and I have generate from it a class ( http://json2csharp.com/ ).
void GETHotels()
{
WebClient c = new WebClient();
c.DownloadStringAsync(new Uri(@"..."));
c.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCompleted);
}
DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
var deserialized = JsonConvert.DeserializeObject<List<Classes.RootObject>>(e.Result);
}
But when I try deserialize e.Result, I get Exception:
Error converting value “[{“hotId”: … 6390285}]” to type
‘System.Collections.Generic.List`1[Hotel_cz.Classes.RootObject]’. Path
”, line 1, position 971.
Can someone help me with this problem?
This should work…