快速解决owin返回json字符串多带了双引号"多了重string转义字符串
内容摘要
解决方法:
[HttpGet]
public HttpResponseMessage getsystemtime()
{
cltime time = new cltime();
time.datetime = DateTime.Now.ToString("yyyy-M
[HttpGet]
public HttpResponseMessage getsystemtime()
{
cltime time = new cltime();
time.datetime = DateTime.Now.ToString("yyyy-M
文章正文
解决方法:
[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转义字符串就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持phpstudy。
代码注释