可能吗?
我有这样的课:
public class ABC
{
[Key]
[ScriptIgnore]
public int Id { get; set; }
public string Name { get; set; }
public string AnotherField { get; set; }
[ScriptIgnore]
public virtual User User { get; set; }
}
但我想像这样序列化{ "name":"foo", "anotherField":"bar" }
而不是
{ "Name":"foo", "AnotherField":"bar" }
.
这就是我的使用方式:
return Request.CreateResponse(HttpStatusCode.OK, new JavaScriptSerializer().Serialize(obj));