【发布时间】:2011-11-15 21:39:43
【问题描述】:
我有一个 ASP.NET MVC 应用程序,它返回一个使用 Json() 方法转换为 JSON 的 Customer 对象。
return Json(Repository.Customer.Get(id));
Customer 对象的属性之一是 Customer.Gender。如果 Gender 属性包含 Null 值,则客户端收到的 JSON 对象包含
Gender: "<null>"
有没有办法让具有 Null 值的属性在 JSON 对象中包含空字符串而不是“null”文本?
【问题讨论】:
标签: c# asp.net .net asp.net-mvc