How can I do array mapping with objectmapper?

you need to use mapArray method instead of map :

let apiResponse = Mapper<ResponseModel>().mapArray(JSONObject: response.result.value)

What I do is something like this:

func mapping(map: Map) {
    if let _ = try? map.value("data") as [Data] {
       dataArray <- map["data"]
    } else {
       data <- map["data"]
    }

    code <- map["code"]
}

where:

var data: T?
var dataArray: [T]?
var code: Int = 0

The problem with this is that you need to check both data and dataArray for nil values.