我正在C#中收到JSON字符串,如下所示:
{
"Id": "617723",
"Acronym": "",
"FirstName": "XXXXX",
"LastName": "XXXXX",
"Groupe": {
"Code": "XXXXX",
"Traductions": {
"French": "",
"English": "XXXXX"
}
},
"BusinessUnit": {
"Code": "XXXXX",
"Traductions": {
"French": "",
"English": "XXXXX"
}
},
"Team": {
"Code": null,
"Traductions": {
"French": "",
"English": null
}
},
"Title": {
"Code": null,
"Traductions": {
"French": "",
"English": "XXXXX"
}
},
"Title2": {
"Code": null,
"Traductions": {
"French": "",
"English": null
}
},
"JobCategory": {
"Code": "XXXXX",
"Traductions": {
"French": "",
"English": "XXXXX"
}
},
"PhoneList": [],
"DateHired": "XXXXX",
"DateTerminated": "XXXXX",
"Gender": "XXXXX",
"ManagerId": "XXXXX",
"ManagerAcronym": "XXXXX",
"IsManager": false,
"Email": null,
"CarLicense": null,
"MyTeam": [],
"HomeBase": {
"Code": "XXXXX",
"Traductions": {
"French": "XXXXX",
"English": "XXXXX"
}
},
"Country": {
"Code": "XXXXX",
"Traductions": {
"French": "XXXXXX",
"English": "XXXXX"
}
},
"State": {
"Code": "XXXXX",
"Traductions": {
"French": "XXXXX",
"English": "XXXXX"
}
},
当我尝试将其反序列化为时List<UsersJson>
,出现以下错误:
无法将当前JSON对象(例如{\“ name \”:\“ value \”})反序列化为类型'System.String []',因为该类型需要JSON数组(例如[1,2,3])来反序列化正确地。要解决此错误,可以将JSON更改为JSON数组(例如[1,2,3]),也可以更改反序列化类型,使其成为普通的.NET类型(例如,不像整数这样的原始类型,也不像这样的集合类型。数组或列表),可以从JSON对象反序列化。还可以将JsonObjectAttribute添加到类型中,以强制其从JSON对象反序列化。路径'[0] .Groupe.Code',第1行,位置87。”
因此,Group
如果不是,我应该如何声明该属性string[]
?
MM们
肥皂起泡泡
繁华开满天机
相关分类