I recently encountered a JSON serialization problem when I was working on a project.
Environment: ASP. NET MVC 4.0
Database: SQL 2008
The Easyui Treegrid binding when the retrieved data is passed from the background in JSON to the foreground by tracing hints: An error occurred while serializing or deserializing using JSON javascriptserializer. The length of the string exceeds the Maxjsonlength property.
Data query table field is more, the data to find more than 4,000 lines, in the Internet search information is generally as follows:
<system.web.extensions> <scripting> <webServices> <jsonserialization Maxjsonlength="1024000" /> </webServices> </scripting></ System.web.extensions>
Try to solve the problem, fortunately, finally found a solution, here to share the next
return New Contentresult { new System.Web.Script.Serialization.JavaScriptSerializer {maxjsonlength = Int32.MaxValue}. Serialize (data), "application/json" };
The serialized data is the table found in the database.
ASP. NET MVC JSON serialization problem