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

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

 

你可能感兴趣的:(返回JSON)