我有如下的JSON响应:
"response": {
"currentPage": 1,
"data": [
{
"id": 153289,
"goalId": 4623,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 8189,
"rewards": {
"5d8c2c245af58": {
"name": "Trip to Hokaido, Japan",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "100"
},
"5d8c2c245af5b": {
"name": "Meal Allowance for 1 month",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "90"
},
"5d8c2c245af5d": {
"name": "Parking Allowance for 1 month",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "80"
}
},
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 130,
"goalItemTotal": 13,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 4623,
"name": "Goal 190926",
"interval": "Daily"
}
},
{
"id": 153274,
"goalId": 4617,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 8178,
"rewards": {
"5d8c2ade757eb": {
"name": "Trip to Hokaido, Japan",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "100"
},
"5d8c2ade757ef": {
"name": "Meal Allowance for 1 month",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "90"
},
"5d8c2ade757f1": {
"name": "Parking Allowance for 1 month",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "80"
}
},
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 130,
"goalItemTotal": 13,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 4617,
"name": "Goal %",
"interval": "Daily"
}
},
{
"id": 152944,
"goalId": 8,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 1236,
"rewards": {
"5cb55b694c1b0": {
"name": "pgr1",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "20"
},
"5cb55b694c1b5": {
"name": "pgr2",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "40"
},
"5cb55b694c1b6": {
"name": "pgr3",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "60"
}
},
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 6,
"goalItemTotal": 3,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 8,
"name": "PG-190416-1233",
"interval": "Daily"
}
},
{
"id": 152950,
"goalId": 21,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 32,
"rewards": {
"5cb5832dcee13": {
"name": "ggr1",
"description": null,
"rewardType": 0,
"reward": null,
"completionRate": "20"
},
"5cb5832dcee16": {
"name": "ggr2",
"description": null,
"rewardType": 0,
"reward": null,
"completionRate": "40"
},
"5cb5832dcee17": {
"name": "ggr3",
"description": null,
"rewardType": 0,
"reward": null,
"completionRate": "60"
}
},
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 6,
"goalItemTotal": 3,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 21,
"name": "GG-190416-1523",
"interval": "Daily"
}
},
{
"id": 153118,
"goalId": 4509,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 7998,
"rewards": {
"5d8879398f27e": {
"name": "Meal Voucher",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "20"
},
"5d8879398f281": {
"name": "bank RM50",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "40"
}
},
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 375,
"goalItemTotal": 4,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 4509,
"name": "Goal's in 31 September",
"interval": "Daily"
}
},
{
"id": 153133,
"goalId": 4511,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 8014,
"rewards": {
"5d8881526c231": {
"name": "Meal Voucher",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "20"
},
"5d8881526c236": {
"name": "bank RM50",
"description": null,
"rewardType": "1",
"reward": null,
"completionRate": "40"
}
},
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 30,
"goalItemTotal": 2,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": "GT-190923 Project in Kuala Lumpur for new branch",
"goal": {
"id": 4511,
"name": "Goal 1-GT-190923",
"interval": "Daily"
}
},
{
"id": 153140,
"goalId": 4512,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 8015,
"rewards": {
"5d8881527479c": {
"name": "Meal Voucher",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "25"
},
"5d888152747a0": {
"name": "bank RM75",
"description": null,
"rewardType": "1",
"reward": null,
"completionRate": "50"
}
},
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 3,
"goalItemTotal": 2,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": "GT-190923 Project in Kuala Lumpur for new branch",
"goal": {
"id": 4512,
"name": "Goal 2",
"interval": "Daily"
}
},
{
"id": 152993,
"goalId": 4434,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 8011,
"rewards": null,
"intervalStartDate": "2019-10-25 00:00:00",
"intervalEndDate": "2019-10-25 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 133,
"goalItemTotal": 4,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 4434,
"name": "HG-190920-1754",
"interval": "Daily"
}
},
{
"id": 139106,
"goalId": 1,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 6661,
"rewards": {
"5cb5595c50832": {
"name": "Meal Voucher",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "20"
},
"5cb5595c50836": {
"name": "bank RM50",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "40"
}
},
"intervalStartDate": "2019-10-21 00:00:00",
"intervalEndDate": "2019-10-27 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 30,
"goalItemTotal": 2,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 1,
"name": "Goal 1",
"interval": "Weekly"
}
},
{
"id": 139117,
"goalId": 2,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 4,
"rewards": {
"5cb5598746005": {
"name": "Meal Voucher",
"description": null,
"rewardType": 0,
"reward": null,
"completionRate": "25"
},
"5cb5598746009": {
"name": "baak RM75",
"description": null,
"rewardType": 0,
"reward": null,
"completionRate": "50"
}
},
"intervalStartDate": "2019-10-21 00:00:00",
"intervalEndDate": "2019-10-27 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 3,
"goalItemTotal": 2,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 2,
"name": "Goal 2",
"interval": "Weekly"
}
},
{
"id": 133427,
"goalId": 2,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 4,
"rewards": {
"5cb5598746005": {
"name": "Meal Voucher",
"description": null,
"rewardType": 0,
"reward": null,
"completionRate": "25"
},
"5cb5598746009": {
"name": "bank RM75",
"description": null,
"rewardType": 0,
"reward": null,
"completionRate": "50"
}
},
"intervalStartDate": "2019-10-14 00:00:00",
"intervalEndDate": "2019-10-20 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 3,
"goalItemTotal": 2,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 2,
"name": "Goal 2",
"interval": "Weekly"
}
},
{
"id": 133416,
"goalId": 1,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 6661,
"rewards": {
"5cb5595c50832": {
"name": "Meal Voucher",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "20"
},
"5cb5595c50836": {
"name": "bank RM50",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "40"
}
},
"intervalStartDate": "2019-10-14 00:00:00",
"intervalEndDate": "2019-10-20 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 30,
"goalItemTotal": 2,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 1,
"name": "Goal 1",
"interval": "Weekly"
}
},
{
"id": 113101,
"goalId": 4580,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 8125,
"rewards": null,
"intervalStartDate": "2019-10-01 00:00:00",
"intervalEndDate": "2019-10-31 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 101,
"goalItemTotal": 2,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 4580,
"name": "Goal Testing in %",
"interval": "Monthly"
}
},
{
"id": 151755,
"goalId": 4989,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 8740,
"rewards": {
"5dafd142455d9": {
"name": "Trip to Hokaido, Japan",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "100"
},
"5dafd142455dc": {
"name": "Meal Allowance for 1 month",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "90"
},
"5dafd142455de": {
"name": "Parking Allowance for 1 month",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "80"
}
},
"intervalStartDate": "2019-10-01 00:00:00",
"intervalEndDate": "2019-10-31 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 130,
"goalItemTotal": 13,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 4989,
"name": "Goal Achieved 01",
"interval": "Monthly"
}
},
{
"id": 107936,
"goalId": 1403,
"userId": 12,
"tenantId": 2,
"department": "Cleaning",
"status": 0,
"grandCompletedRate": "0.00",
"grandCompletedScore": "0.00",
"goalItemId": 7820,
"rewards": {
"5d30636e3062b": {
"name": "Meal Voucher",
"description": null,
"rewardType": "0",
"reward": null,
"completionRate": "25"
},
"5d30636e3062f": {
"name": "dddf RM75",
"description": null,
"rewardType": "1",
"reward": null,
"completionRate": "50"
}
},
"intervalStartDate": "2019-10-01 00:00:00",
"intervalEndDate": "2019-10-31 00:00:00",
"rewardStatus": 0,
"rewardedAmount": "0.00",
"deletedAt": null,
"totalItemsPoint": 78,
"goalItemTotal": 12,
"goalItemCompleted": 0,
"goalItemPending": 0,
"pendingApprovalSetting": "1",
"teamName": null,
"goal": {
"id": 1403,
"name": "190920-Goal's Testing for Character\"s",
"interval": "Monthly"
}
}
],
}
我想做的是列出数据并获得reward.name但是,在访问reward.name之前,有一个动态密钥,例如5d8c2c245af58
,5d8c2c245af5b
等。
我试图生成数据模型,但这是我得到的:https://app.quicktype.io?share=dLZbMPMkhMpoYO4PiImr。
class Rewards {
HammerfestPonies the5D8C2C245Af58;
HammerfestPonies the5D8C2C245Af5B;
HammerfestPonies the5D8C2C245Af5D;
HammerfestPonies the5D8C2Ade757Eb;
HammerfestPonies the5D8C2Ade757Ef;
HammerfestPonies the5D8C2Ade757F1;
HammerfestPonies the5Cb55B694C1B0;
HammerfestPonies the5Cb55B694C1B5;
HammerfestPonies the5Cb55B694C1B6;
The5Cb5 the5Cb5832Dcee13;
The5Cb5 the5Cb5832Dcee16;
The5Cb5 the5Cb5832Dcee17;
HammerfestPonies the5D8879398F27E;
HammerfestPonies the5D8879398F281;
HammerfestPonies the5D8881526C231;
HammerfestPonies the5D8881526C236;
HammerfestPonies the5D8881527479C;
HammerfestPonies the5D888152747A0;
HammerfestPonies the5Cb5595C50832;
HammerfestPonies the5Cb5595C50836;
The5Cb5 the5Cb5598746005;
The5Cb5 the5Cb5598746009;
HammerfestPonies the5Dafd142455D9;
HammerfestPonies the5Dafd142455Dc;
HammerfestPonies the5Dafd142455De;
HammerfestPonies the5D30636E3062B;
HammerfestPonies the5D30636E3062F;
我希望在ListView中显示数据列表,但我正在努力在数据模型中映射动态键
使用json进行锐化
public class Rewards
{
public string name { get; set; }
public object description { get; set; }
public string rewardType { get; set; }
public object reward { get; set; }
public string completionRate { get; set; }
}
public class Goal
{
public int id { get; set; }
public string name { get; set; }
public string interval { get; set; }
}
public class RootObject
{
public int id { get; set; }
public int goalId { get; set; }
public int userId { get; set; }
public int tenantId { get; set; }
public string department { get; set; }
public int status { get; set; }
public string grandCompletedRate { get; set; }
public string grandCompletedScore { get; set; }
public int goalItemId { get; set; }
public Rewards rewards { get; set; }
public string intervalStartDate { get; set; }
public string intervalEndDate { get; set; }
public int rewardStatus { get; set; }
public string rewardedAmount { get; set; }
public object deletedAt { get; set; }
public int totalItemsPoint { get; set; }
public int goalItemTotal { get; set; }
public int goalItemCompleted { get; set; }
public int goalItemPending { get; set; }
public string pendingApprovalSetting { get; set; }
public string teamName { get; set; }
public Goal goal { get; set; }
}