I\'m building a winForms app in NET3.5SP1 using VS2008Express. Am trying to deserialize an object using the System.Web.Script.Serialization library.
The error is: T
It's great you found your error. If you are looking for another tool for JSON serialization you might want to try JSON.Net.
I found my error.. should be:
Cheers
JavaScriptSerializer serializer = new JavaScriptSerializer();
// create a generic list of categories
List<Category> listOfCategories = new List<Category>();
// deserialize as a list of Categories, and put into listOfCategories
listOfCategories = serializer.Deserialize<List<Category>>(s);
//iterate through list and display in text box
foreach (Category item in listOfCategories)
{
textBox2.Text += item.categoryid.ToString() + "\r\n";
textBox2.Text += item.name.ToString() + "\r\n";
textBox2.Text += item.serverimageid.ToString() + "\r\n";
textBox2.Text += item.dateuploaded.ToString() + "\r\n";
textBox2.Text += item.enabled.ToString() + "\r\n";
}