C#WebAPI返回json去掉双引号前面的反斜杠

时间:2018-04-04 13:29:28   收藏:0   阅读:981
 
string str="{\"msgType\":1001,\"msgstring\":\"信息\"}";//这里是你的json带有反斜杠的
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") };//这里是去掉反斜杠再放回出去,json就只剩下双引号。
            return result;

原文:https://www.cnblogs.com/taozihua/p/8716362.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!