Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.








JavaScriptSerializer Constructor (resolver)

Initializes a new instance of the JavaScriptSerializer class with a custom type resolver.



public JavaScriptSerializer (
	JavaScriptTypeResolver resolver


Public Sub New ( _
	resolver As JavaScriptTypeResolver _


JavaScriptSerializer (
	JavaScriptTypeResolver^ resolver


public JavaScriptSerializer (
	JavaScriptTypeResolver resolver


resolver (JavaScriptTypeResolver)

The custom type resolver object.


When serializing an object, the JavaScriptSerializer class uses the resolver parameter to determine the appropriate value to include in the serialized JavaScript Object Notation (JSON) string for the type metadata marker ("__type"). Similarly, when deserializing a JSON string, JavaScriptSerializer resolves the type metadata marker value to the appropriate managed type by using the resolver instance.

You can set the resolver parameter to null, which is equivalent to calling the JavaScriptSerializerNew constructor.

Note that the instance of JavaScriptSerializer used by the asynchronous communication layer for invoking Web services from client script uses a special type resolver. This type resolver restricts the types that can be deserialized to those defined in the Web service’s method signature, or the ones that have the GenerateScriptTypeAttribute applied. You cannot modify this built-in type resolver programmatically.

Assembly: System.Web.Extensions (Module: System.Web.Extensions)