While searching, I ended up with following solution:
The default maximum length for MaxJsonLength is 102400 characters.
You can set the MaxJsonLength property on your web.config:
If you are still receiving the error:
As a workaround, you can do the following within code
serializer.MaxJsonLength = Int32.MaxValue;
string jsonresult = serializer.Serialize(rowData);
Happy Coding 🙂