Quick solution to owin return json string with double quotation marks'extra heavy string escape string

  • 2021-11-02 02:04:09
  • OfStack

Solution:


 [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;

    }

Related articles: