This documentation is archived and is not being maintained.

JavaScriptConverter.Deserialize Method

When overridden in a derived class, converts the provided dictionary into an object of the specified type.

Namespace:  System.Web.Script.Serialization
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public abstract Object Deserialize(
	IDictionary<string, Object> dictionary,
	Type type,
	JavaScriptSerializer serializer


Type: System.Collections.Generic.IDictionary<String, Object>

An IDictionary<TKey, TValue> instance of property data stored as name/value pairs.

Type: System.Type

The type of the resulting object.

Type: System.Web.Script.Serialization.JavaScriptSerializer

The JavaScriptSerializer instance.

Return Value

Type: System.Object
The deserialized object.

Notes to Inheritors:

The Deserialize method iterates through the values in the dictionary parameter to construct an instance of the type requested in the type parameter. Although a converter can directly use values from dictionary, we recommend that the converter implementer use the ConvertToType<T> method instead. The converter should call this method of the JavaScriptSerializer instance available from the serializer parameter.

The ConvertToType<T> method enables converter to pass a property value from dictionary, and then return a value of the expected type. In some cases, a converter for a custom type might be working with properties that themselves have registered converters (for example, type A has a property of type B, and type B is also associated with a custom converter). In that case, invoking ConvertToType<T> makes sure that custom converters will be recursively invoked for property data that is contained in the dictionary. When the converter has iterated through all entries in the dictionary, it returns a constructed instance of the target type.

If the converter encounters a problem during deserialization, it should throw an InvalidOperationException error that describes the problem.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5