【发布时间】:2016-04-06 16:57:20
【问题描述】:
是否有反序列化选项可以使用Json.NET 执行区分大小写反序列化?
建议:
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public IList<string> Roles { get; set; }
}
从以下位置反序列化时必须失败:
{
"email": "james@example.com",
"active": true,
"createdDate": "2013-01-20T00:00:00Z",
"roles": [
"User",
"Admin"
]
}
【问题讨论】:
-
为什么要失败?在变量名中混合大小写会导致几个月后的维护噩梦
标签: c# json.net deserialization