快速解决owin返回json字符串多带了双引号"多了重string转义字符串

时间:2022-01-06 05:21:39

解决方法:

?
1
2
3
4
5
6
7
8
9
10
[HttpGet]
   public HttpResponseMessage getsystemtime()
   {
     cltime time = new cltime();
     time.datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
     string relsut = JsonConvert.SerializeObject(time);
     var resp = new HttpResponseMessage { Content = new StringContent(relsut, System.Text.Encoding.UTF8, "application/json") };
     return resp;
 
   }

以上这篇快速解决owin返回json字符串多带了双引号"多了重string转义字符串就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。