An error is reported when deserializing or serializing using JSON JavaScriptSerializer. The length of the character exceeds the length of MaxJsonLength,
Article reference: https://www.cnblogs.com/wangfuyou/p/6046307.html
1. The solution is to add the following nodes in web. config to <configuration>.
<System. web. extensions>
<Scripting>
<WebServices>
<JsonSerialization maxJsonLength = "1024000000" type = "codeph" text = "/codeph"/>
</WebServices>
</Scripting>
</System. web. extensions>
2.
1 RootObject ScriptDeserialize (string json) 2 {3 // the maximum length of the JSON string. The default length is 2097152 characters, which is equivalent to 4 MB of Unicode string data. 4 // js. maxJsonLength = 2097152; 5 js. maxJsonLength = 10240000; 6 JavaScriptSerializer jsseria = new JavaScriptSerializer (); 7 jsseria. maxJsonLength = Int32.MaxValue; 8 return js. deserialize <RootObject> (json); 9}
Tip: you cannot directly modify the json size because the default value is used in the built-in JsonResult code of the MVC framework when using JavaScriptSerializer. If the value is not read from maxJsonLength, this configuration is ignored.
So we need to rewrite it to overwrite the original configuration.