1
我正在使用擁有getter和setter的POJO類。但是,由於這種動態行爲,我將被迫使用反序列化部分。我也已經實現了代碼,但是還有其他方法可以解決這個問題。因爲,下面粘貼響應是實際響應的僅有一小部分(這是大規模和我使用它POJO getter和setter)Retrofit - 處理具有動態結構的JSON密鑰 - Array/Object
OBJECT
secondaryUser: {
id: 1,
username: "admin",
numberOfFollowers: 1,
displayName: "admin"
}
ARRAY
secondaryUser: [
{
id: 18150,
activityDateTime: "2015-07-20 14:46:02",
user: {
id: 1,
username: "admin",
numberOfFollowers: 1,
displayName: "admin"
}
},
{
id: 18148,
activityDateTime: "2015-07-20 13:35:02",
user: {
id: 3,
username: "USER_1",
numberOfFollowers: 4,
displayName: "USER_1"
}
},
{
id: 18146,
activityDateTime: "2015-07-20 11:29:41",
user: {
id: 2468,
username: "USER_2",
numberOfFollowers: 1,
displayName: "USER_2"
}
}
]
}