【发布时间】:2014-12-18 10:34:49
【问题描述】:
我必须反序列化一个在根对象名称中包含冒号的 JSON 对象数组。
有谁知道我是否可以在列表定义中使用冒号以某种方式实现这一点?
public List<Customers> ngcp:customers { get; set; }
【问题讨论】:
我必须反序列化一个在根对象名称中包含冒号的 JSON 对象数组。
有谁知道我是否可以在列表定义中使用冒号以某种方式实现这一点?
public List<Customers> ngcp:customers { get; set; }
【问题讨论】:
不,正确的方法是使用 json.net 支持的属性或其他方法指定名称。
[JsonProperty(PropertyName = "ngcp:customers")]
public List<Customers> Customers { get; set; }
【讨论】: