使用LitJson报错 Max allowed object depth reached while trying to export from type System.Collections.Generic.List
1 2 |
string json = JsonMapper.ToJson(list); context.Response.Write(json); |
改为使用Newtonsoft.Json.dll
1 2 |
string json = JsonConvert.SerializeObject(list); ; context.Response.Write(json); |
使用Newtonsoft.Json.dll报错Self referencing loop detected with type,原因是实体集合里面存在导航属性,去掉相关属性即可
1 |
var newlist = list.Select(a => new { a.OrderNo, a.ID, a.Amount }).ToList(); |