How to deserialize a json parameter that maybe List or String

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
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 {
var errorMessage: List<String>? = null

Is there any way I can cater this scenario?