Got a API spec with the field definition as follows:
Parameter: errorMessage
Details: Return a List. If no data for error message, empty string will be returned.
Tried to get the data and it may return List or an empty string
When return empty string
“warningMessage”:“”
When return List
“warningMessage”:[“error detail 1”, “error detail 2”]
I tried as follows but there will be error when it is giving empty string
class testMessage {
@SerializedName(“errorMessage”)
var errorMessage: List<String>? = null
}
Is there any way I can cater this scenario?