public void GetGifts() { List<dynamic> gifts = new List<dynamic>(); Gift allgifts = new Gift(); allgifts.LoadAll(); if (allgifts.RowCount > 0) { for (int i = 0; i < allgifts.RowCount; i++) { gifts.Add(new { giftid = allgifts.GiftID, name = allgifts.Name, price = allgifts.IsColumnNull("Price_Point") ? "0" : allgifts.Price_Point.ToString(), picPath = allgifts.PicPath, AudioPath = allgifts.AudioPath }); allgifts.MoveNext(); } } string result = Newtonsoft.Json.JsonConvert.SerializeObject(gifts); HttpContext.Current.Response.ContentType = "application/json; charset=utf-8"; HttpContext.Current.Response.Write(result); //return result; }