JSON maxjsonlength Error

Source: Internet
Author: User

"Message": "error during serialization or deserialization using the JSON parameter criptserializer.
The length of the string exceeds the value set on the maxjsonlength property. "," stacktrace ":"
In system. Web. Script. serialization. javascriptserializer.
Serialize (Object OBJ, stringbuilder output, serializationformat) \ r \ n
In system. Web. Script. serialization. javascriptserializer. serialize (
Object OBJ, serializationformat) \ r \ n
In system. Web. Script. Services. resthandler. invokemethod
(Httpcontext context, webservicemethoddata methoddata, idictionary '2 rawparams) \ r \ n
In system. Web. Script. Services. resthandler.
Executewebservicecall (httpcontext context, webservicemethoddata methoddata) "," exceptiontype ":" system. invalidoperationexception "}"

[Reprinted] while working with Ajax calland dealing with JSON data you may encounter this exception "exception message: error during serialization or deserialization using the JSON parameter criptserializer. the length of the string exceeds the value set on the maxjsonlength property ". the reason is that the data which you are dealing with for Ajax call has crossed the default limit which is defined for jsonserialization.

From msdn: http://msdn.microsoft.com/en-us/library/bb763183.aspx

"Maxjsonlength. specifies the maximum length of the JSON string (the maximum number of UTF-8 characters). The default length is 102400 ."

So the solution is that you need to increase the value for jsonserialization attribute. For example I set it to "500000"

View sourceprint

<System. Web. Extensions>

<Scripting>

<WebServices>

<Jsonserialization maxjsonlength = "500000" type = "codeph" text = "/codeph"/>

</WebServices>

</Scripting>

</System. Web. Extensions>

Below is the screen shot with the position where you need to place the "jsonserialization" tag.>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.