We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error serialization in Grid Control using JSON


I'm in trouble with the serialization of my data in my Grid Control, I get the following message: "Error during serialization or deserialization using JSON JavaScriptSerializer. The size of the string exceeds the value set in maxJsonLength property".

I've seen some alternatives in forum, but nothing help me.
I do not want paging in my grid and I have to have all the data on the screen to be analyzed.
I have to render it without being in Json? Or you have another alternative?

2 Replies

AS André Secco May 10, 2016 07:05 PM UTC

I already try input the config in web.config (But not working):

      <jsonSerialization maxJsonLength="50000000"/>
I researched on the internet and saw that can happen because web.config setting will be ignored because you're using an internal instance of the JavaScriptSerializer.
In the forums it is recommended to do the following (Adding MaxJsonLength property):
protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
    return new JsonResult()
        Data = data,
        ContentType = contentType,
        ContentEncoding = contentEncoding,
        JsonRequestBehavior = behavior,
        MaxJsonLength = Int32.MaxValue
As the Grid component of Syncfusion is compiled, I have no way to access and make a override. Any idea how to solve (without paging)?

JK Jayaprakash Kamaraj Syncfusion Team May 11, 2016 09:14 AM UTC

Hi André, 
Thank you for contacting Syncfusion support. 

In our latest MVC grid, we have rendered all the html elements in client side and we have passed the data to the control from server side to client side as Json data by serializing it.  

And we have used the default MaxJsonLength value (2097152 characters, which is equivalent to 4 MB of Unicode string data) of the JavaScriptSerializer which is a fixed universal standard length for serializing the data.  

We have already discussed the same issue in following knowledge base document.   
Jayaprakash K. 

Live Chat Icon For mobile
Up arrow icon