title: MaxJsonLength exception in ASP.NET MVC4 during JavaScriptSerializer
body: <p>In one of my controller actions,when I return a more than 10000 rows JsonResult to the view.
  I will get the below exceptions.</p>
  
  <p>Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
  <a href="https://i.stack.imgur.com/T4CRV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T4CRV.png" alt="enter image description here"></a></p>
  
  <p>I have setted the maxJsonLength property in the web.config to a higher value unfortunately does not show any effect like below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  &lt;system.web.extensions&gt;
      &lt;scripting&gt;
        &lt;webServices&gt;
          &lt;jsonSerialization maxJsonLength="2147483644"/&gt;
        &lt;/webServices&gt;
      &lt;/scripting&gt;
    &lt;/system.web.extensions&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And I also set the MaxJsonLength when I used Json class like below:</p>
  
  <pre><code>    public JsonResult GetList(GridPager pager, string queryStr)
      {
          List&lt;SysExceptionModel&gt; list = _exceptionBLL.GetList(ref pager, queryStr);
          var json = new
          {
              total = pager.totalRows,
              rows = list.ToArray()
          };
  
          var jsonresults = Json(json);
          jsonresults.MaxJsonLength = int.MaxValue;
          return jsonresults;
      }
  </code></pre>
  
  <p>These two settings would not help me.
  I was confused.</p>
  
  <p>one row is like below:</p>
  
  <p>0000688A-85F5-4F72-BE86-85BCADED2DE NULL BBBB BBBB BBBB BBBB BBBB 2015-10-22 02:27:38.000</p>