[Solved] ASP.Net MVC JSON Error: The length of the string exceeds the value set on the maxJsonLength property

on Jul 15, 2021 11:57 PM

Hi Developers,

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

I got the Above mentioned error when i get base64 string length of 2974208 Jquery Ajax call on following line 

"var Retdata = JSON.parse(response.ResponseContent);"

Added in Web.Config : 

<add key="JSONMAXJSONLENGTH" value="2147483644" />
<add key="aspnet:MaxJsonDeserializerMembers" value="2147483644" />
<add key="aspnet:UpdatePanelMaxScriptLength" value="2147483644" />
<add key="aspnet:MaxJsonDeserializerMembers" value="2147483644"/>


<httpRuntime targetFramework="4.5" enableVersionHeader="false" executionTimeout="1"  maxRequestLength="2000000000" maxQueryStringLength = "12288" maxUrlLength="12288"/>

If anyone know the solution for this problem kindly help me to done this task.

Thanks & Regards


Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Jul 15, 2021 11:59 PM
on Jul 16, 2021 12:01 AM

Hi paulrajmca,

The solution to this problem is to set a higher value of maxJsonLength property through Web.Config configuration using the system.web.extensions section as shown below.

            <jsonSerialization maxJsonLength="2147483644" />