I've searched Stack Overflow before posting, but there were no solutions for Jackson.
Here is a server response:
{
"ok": true,
"result": [
{
"update_id": 489881731,
//rest
},
{
"update_id": 489881732,
//rest
}
]
}
As you see property "result" is an array.
Now this is another response:
{
"ok": true,
"result": {
"id": 211948704,
"first_name": "ربات ادمینهای تلگرام",
"username": "tgAdminsBot"
}
}
Here "result" is a single object.
This is my class I want to deserialize content to it. I wrote a custom deserializer for TObject of course:
public class Result
{
private TObject[] result;
private boolean ok;
public void setOk (boolean ok) {//code}
public void setResult (TObject[] result) {//code}
public TObject[] getResult () {//code}
public boolean getOk (){//code}
}
So I assumed in my class that "result" is an array of TObjects. Now what can I do? Is using @JsonProperty("result") for two fields which one is an array of TObjects and one is a single TObject OK?
If not what else can I do?