我想在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
但现在显示。 出乎意料的'