NET NewtonSoft JSON将映射反序列化为不同的属性名称
{ "team":[ { "v1":"", "attributes":{ "eighty_min_score":"", "home_or_away":"home", "score":"22", "team_id":"500" } }, { "v1":"", "attributes":{ "eighty_min_score":"", "home_or_away":"away", "score":"30", "team_id":"600" } } ]}
public class Attributes{ public string eighty_min_score { get; set; } public string home_or_away { get; set; } public string score { get; set; } public string team_id { get; set; }}public class Team{ public string v1 { get; set; } public Attributes attributes { get; set; }}public class RootObject{ public List<Team> team { get; set; }}
Attributes
类名attributes
字段名Team
TeamScore
_
JsonConvert.DeserializeObject<RootObject>(jsonText);
Attributes
TeamScore
attributes
Team
null