第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

NET NewtonSoft JSON將映射反序列化為不同的屬性名稱

NET NewtonSoft JSON將映射反序列化為不同的屬性名稱

婷婷同學_ 2019-07-10 15:08:26
NET NewtonSoft JSON將映射反序列化為不同的屬性名稱下面是來自外部方的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..我怎樣才能克服這一切?
查看完整描述

4 回答

  • 4 回答
  • 0 關(guān)注
  • 3637 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號