How in Retrofit to process JSON with a field in which different data types come? (Specification: in the answer comes many typed fields, but for example, one free_val is not typed) For example, there is a JSON responce
- option 1 {free_val: "any text"}
- option 2 {free_val: {p1: 1, p2: 2}}
- option 3 {free_val: {[1,2,3]}
How to describe JSON so that a string would always come even if it is an array or structure while {p1: 1, p2: 2} returns as String "{p1: 1, p2: 2}"
class MyModel{ @SerializedName("free_val") @Expose //Может как-то можно указать, что это всегда строка? //чтобы получать {free_val:{p1:1, p2:2}} как "{p1:1, p2:2}" String freeVal; // далее геттеры сеттер }