使用 JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串的长度超过了为 maxJsonLength 属性设置的值。

出现这种问题可以将JsonResultMaxJsonLength设置成最大。

加入 result.MaxJsonLength = Int32.MaxValue; 

Int32位最大可以赋值为:2147483647。

                JsonResult result = new JsonResult();
                result.Data = new
                {
                    code = "10000",
                    message = "成功",
                    arraydata = list.Select(s => new {
                        name = s.Name
                    })
                };
                result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                result.MaxJsonLength = Int32.MaxValue;   //将result调至Int32最大值
                return result;

 

相关文章:

  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-29
  • 2021-08-16
相关资源
相似解决方案