.NET MVC: Return Long Json Data From a Controller

12/15/2015 1:27:21 AM

The following error can be corrected by setting the MaxJsonLength.

Exception message: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

var resultData = new { Model = model, Html = html };
return new JsonResult()
{
	Data = resultData,
	MaxJsonLength = Int32.MaxValue
};