[Route("api/Message/MessageList/")] [HttpGet] public HttpResponseMessage MessageList() { ResponseResult obj = new ResponseResult(); var pageData = Ydt.ExtLib.DataTableHelper.DataTableToList<ViewGoodChart>(result.Tables[0]); List<JObject> list = new List<JObject>(); foreach (var item in pageData) { list.Add(JObject.FromObject(item)); } obj.info = list; obj.status = true; obj.message = "获取成功"; JsonStr = JsonConvert.SerializeObject(obj); //返回纯文本text/plain ,返回json application/json ,返回xml text/xml HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonStr, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; }