//测试对象集合序列化 public void jsonTest() { List<moduleEntity> list = new List<moduleEntity>(); for (int i = 1; i < 5;i++) { moduleEntity entity = new moduleEntity(); entity.id = i + "0"; entity.sortNumber = i; entity.moduleFlag = "flag"+i; entity.moduleName = "name"+i; entity.moduleUrl = "url" + i; entity.moduleImage = "image" + i; entity.createDatetime = DateTime.Now; list.Add(entity); } JavaScriptSerializer jss = new JavaScriptSerializer(); string jsonString = jss.Serialize(list); this.Response.Write(list); }