title: .NET JSON.decode() fails for large arrays
body: <p>MVC 4 ASP.NET Web API application : </p>
  
  <p>I have a JSON array of form : </p>
  
  <pre><code>var json = "{
      'mapset':
      [
          {
              'id': '1',
              'key': 'key1',
              'value': 'value1',
              'timestamp': '2014-02-12T08:50:54.594Z'
          },
          {
              'id': '2',
              'key': 'key2',
              'value': 'value2',
              'timestamp': '2014-02-12T08:50:54.594Z'
          },
      ]
  }";
  
  dynamic data = System.Web.Helpers.JSON.decode(json);
  </code></pre>
  
  <p>For array with 10K elements of ~1K bytes each, <code>JSON.Decode()</code> works like a charm.</p>
  
  <p>For 100K elements fails with error : </p>
  
  <blockquote>
    <p>System.ArgumentException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.Parameter name: input   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)   at System.Web.Helpers.Json.Decode(String value) </p>
  </blockquote>
  
  <p>How can I set the limit higher ?</p>
  
  <p>I am aware of the other post regarding this topic : </p>
  
  <p><a href="https://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config">Can I set an unlimited length for maxJsonLength in web.config?</a></p>
  
  <p>However the answers provided there do not solve my specific problem.</p>
  
  <p>I am directly using <code>JSON.Decode()</code> within an MVC4 app and so modification of <code>web.config</code> settings will not apply.  And <code>JSON.Decode()</code> performs deserialization of a JSON string to a .NET JSON object ( not serialization of a .NET JSON object to a JSON string ).</p>