一佳一

记录像1+1一样简洁的代码

导航

web api 返回 去除双引号转义符

Posted on 2021-12-27 13:11  一佳一  阅读(223)  评论(0编辑  收藏  举报

res = "{\"msg\":\"ok\",\"code\":200,\"data\":{\"url\":\"" + img + "\"}}";
return new HttpResponseMessage { Content = new StringContent(res, System.Text.Encoding.UTF8, "application/json") };

注意 必须用 HttpResponseMessage  类型是 JSON 否者还是带反斜杠输出