JavaScriptSerializer.MaxJsonLength Property (System.Web.Script.Serialization)

Switch View :
ScriptFree
.NET Framework Class Library
JavaScriptSerializer.MaxJsonLength Property

Gets or sets the maximum length of JSON strings that are accepted by the JavaScriptSerializer class.

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

Visual Basic (Declaration)
Public Property MaxJsonLength As Integer
Visual Basic (Usage)
Dim instance As JavaScriptSerializer
Dim value As Integer

value = instance.MaxJsonLength

instance.MaxJsonLength = value
C#
public int MaxJsonLength { get; set; }
Visual C++
public:
property int MaxJsonLength {
	int get ();
	void set (int value);
}
JScript
public function get MaxJsonLength () : int
public function set MaxJsonLength (value : int)

Property Value

Type: System.Int32
The maximum length of JSON strings. The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.
Exceptions

Exception Condition
ArgumentOutOfRangeException

The property is set to a value that is less than one.

Remarks

The value of the MaxJsonLength property applies only when you explicitly create an instance of the JavaScriptSerializer class. Use the jsonSerialization element of the configuration file to set the maximum length for the internal serializer instance that is used by the asynchronous communication layer. For more information about the configuration elements for serialization, see How to: Configure ASP.NET Services in ASP.NET AJAX.

Platforms

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.
Version Information

.NET Framework

Supported in: 3.5
See Also

Reference