public void getSupplyDescImg(HttpContext context) { List <SupplyImg> list = supplyService.getSupplyDescImg(Convert.ToInt32(context.Request["Id"])); StringBuilder sb = new StringBuilder(); Dictionary <String, Object> dictionary = new Dictionary <String, Object>(); string imgPath = "defaultImg.jpg"; sb.Append("["); int i = 1; foreach (SupplyImg supplyImg in list) { if (supplyImg.ImgPath != null) { imgPath = System.IO.Path.GetFileName(supplyImg.ImgPath); } dictionary.Add("DescImg", imgPath); sb.Append(JsonUtil.toJson(dictionary)); if (i < list.Count) { sb.Append(","); } dictionary.Clear(); i++; } sb.Append("]"); context.Response.Write(sb.ToString()); }