Vote count: 0 I want to deserialize a JSON string using the same POJO for two king of messages. Take a look at the message below { "success": true, "data": [ { "id": 2, "comments": null }, { "id": 3, "comments": null } ] } The data is an array, but sometimes the data is a single object: { "success": true, "data": { "id": 2, "comments": null } } My POJO looks like this: public void setData(List data) { this.data = data; } Is there any way to deserialize the second message (where data is not an array) using the same class? Kind regards, Ricardo asked 1 min agouser1972700 Let's block ads! بخوانید...
ادامه مطلب