System.Web.Script.Serialization.JavaScriptSerializer is a class which provides JSON serialization and deserialization functionality for applications and web sites targetting the .NET Framework. Use this tag for questions about this specific class only. For more general JavaScript/JSON serialization questions use the [json] and [serialisation] tags.
System.Web.Script.Serialization.JavaScriptSerializer
is a class which provides JSON serialization and deserialization functionality for applications and web sites targetting the .NET Framework.
Use this tag for questions about the Microsoft class. For more general JSON serialization questions use both the json and serialisation tags.
MSDN Remarks
The JavaScriptSerializer class is used internally by the asynchronous communication layer to serialize and deserialize the data that is passed between the browser and the Web server. You cannot access that instance of the serializer. However, this class exposes a public API. Therefore, you can use the class when you want to work with JavaScript Object Notation (JSON) in managed code.
To serialize an object, use the Serialize method. To deserialize a JSON string, use the Deserialize or DeserializeObject methods. To serialize and deserialize types that are not natively supported by JavaScriptSerializer, implement custom converters by using the JavaScriptConverter class. Then register the converters by using the RegisterConverters method.
Example
public abstract class AsSerializable
{
public string AsJson()
{
var serializer = new JavaScriptSerializer();
return serializer.Serialize(this);
}
}
public class Foo : AsSerializable
{
public string Bar { get; set; }
}
string JSON = Foo.AsJson();
MSDN Article
JavaScriptSerializer Code
Performance Benchamrks