Q:

How to serialize an object in windows phone 7

How to convert an object to JSON data in windows phone. In web application I have used following code
 JavaScriptSerializer serializer = new JavaScriptSerializer();
 string stringData = serializer.Serialize(object);

I want to get the same output as that of the above code in windows phone 7.

A:

JavaScriptSerializer is not supported on Windows Phone. An alternative is to use JSON.NET (you can add it via NuGet).  
The code will then look like this:
string stringData = JsonConvert.SerializeObject(object);

