【发布时间】:2015-02-19 21:33:43
【问题描述】:
s型号:
public class Product
{
public string NameEN { get; set; }
public string NameFR { get; set; }
public double Price { get; set; }
}
控制器:
// GET: api/Products/5
[ResponseType(typeof(Product))]
public IHttpActionResult GetProduct(int id)
{
return Ok(new Product(){NameEN = "Cookie", NameFR = "Biscuit", Price = 10});
}
我想要这个结果:
{"Name" = "Cookie", "Price" = "10"}
产品存储在数据库中
如何在序列化过程中使用所需的 Accept-Language 将我的属性 NameEN 和 NameFR 转换为 Name?
谢谢
【问题讨论】:
标签: asp.net-mvc asp.net-web-api json.net