我想在json中使用来自asp.net中的web api的对象名来显示简单的字符串

时间:2017-12-05 07:20:46

标签: asp.net json asp.net-web-api

我想在json中用对象名称显示简单的字符串,如何在json结果下面添加序列化对象名称

 string dpath = HttpContext.Current.Server.MapPath("../dir/");
        string mainPath = dpath + id + "\\fil.pdf";

        byte[] pdfBytes = File.ReadAllBytes(mainPath);
        string pdfBase64 = Convert.ToBase64String(pdfBytes);

        return new HttpResponseMessage()
        {
            Content = new StringContent(pdfBase64, 
            System.Text.Encoding.UTF8, "application/json")
        };

我想要输出     档案:" djkhfdjkfhkjdhkjhd"作为josn

但现在显示。 出乎意料的'

0 个答案:

没有答案