Thursday, August 27, 2015

How to change maxJsonLength property in web.config

How to change maxJsonLength property in web.config
This article explains how to solve the problem of “Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.” in using c#.

Generally this problem occur whenever our json result set length exceeds default json MaxJsonLength property value. By default MaxJsonLength property will allow 102400 (100k) in case our string exceeding this length we will get JavaScriptSerializer error.

To solve this problem we need to set MaxJsonLength property value in web.config file like as shown below

<jsonSerialization maxJsonLength="3000000"/>

Once we add above code snippet in web.config file automatically our problem will get solve.


Post a Comment