Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DeserializeObject Method

JavaScriptSerializer.DeserializeObject Method

Converts the specified JSON string to an object graph.

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

public Object DeserializeObject(
	string input
)

Parameters

input
Type: System.String
The JSON string to be deserialized.

Return Value

Type: System.Object
The deserialized object.

ExceptionCondition
ArgumentNullException

input is null.

ArgumentException

The input length exceeds the value of MaxJsonLength.

-or-

The recursion limit defined by RecursionLimit was exceeded.

-or-

input contains an unexpected character sequence.

-or-

input is a dictionary type and a non-string key value was encountered.

-or-

input includes member definitions that are not available on the target type.

InvalidOperationException

input contains a "__type" property that indicates a custom type, but the type resolver that is currently associated with the serializer cannot find a corresponding managed type.

-or-

input contains a "__type" property that indicates a custom type, but the result of deserializing the corresponding JSON string cannot be assigned to the expected target type.

-or-

input contains a "__type" property that indicates either Object or a non-instantiable type (for example, an abstract type or an interface).

-or-

An attempt was made to convert a JSON array to an array-like managed type that is not supported for use as a JSON deserialization target.

-or-

It is not possible to convert input to the target type.

This deserialization method does not try to cast the root of the object graph to a specific type, as with the Deserialize method.

.NET Framework

Supported in: 4, 3.5

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2015 Microsoft