![]() |
礼貌的啄木鸟 · Howler.js通过Rails ...· 2 年前 · |
![]() |
气宇轩昂的椅子 · es将结果按时间排序-掘金· 2 年前 · |
![]() |
安静的感冒药 · 数字图像处理实验(四)|图像压缩与编码实验{ ...· 2 年前 · |
![]() |
玩足球的风衣 · navigator.getusermedia ...· 2 年前 · |
![]() |
憨厚的佛珠 · bash - cURL send JSON ...· 2 年前 · |
我使用MVC4 web-api,c#,并希望使用Json.net.返回Json 。
问题是它伴随着“反斜线”。
我还将这段代码添加到Global.asax中。GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
以下是它返回的内容:
"{\"cid\":1,\"model\":\"WT50JB\",\"detail\":\"sdf??\",\"unit\":2,\"time_in\":\"2012-12-11T19:00:00\",\"time_out\":\"2012-12-12T13:00:06.2774691+07:00\",\"time_used_dd\":0.0,\"time_used_hh\":0.0}"
所以我想看到的是:{"cid":1,“WT50JB”,“WT50JB”,“detail”:“sdf?”,"unit":2,"time_in":"2012-12-11T19:00:00",time_in "time_used_dd":0.0,"time_used_hh":0.0}
这是JsonConvertor
string json = JsonConvert.SerializeObject(myObj);
发布于 2017-02-21 10:30:51
我找到了解决方案,而且它对我有用:
var json = JsonConvert.SerializeObject(sb.ToString(), Formatting.Indented);
response.Content = new StringContent(json, Encoding.UTF8 , "application/json");
https://stackoverflow.com/questions/13833900
复制相似问题
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2024 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号: 粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
![]() |
气宇轩昂的椅子 · es将结果按时间排序-掘金 2 年前 |