首页 > 代码库 > WebApi中直接返回json字符串的方法

WebApi中直接返回json字符串的方法

[HttpPost]public HttpResponseMessage Upload(){string json = "{\"result\":\"true\"}";return new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") };}