Note. I need to use ObjectMapper, not AlamoFireObjectMapper.
How do you make a map without going to JSON, but from responseJSON data to map to the user? The following tries to move from responseJSON to jsonn and then revert back to the data (being the user). I think there should be a way?
Or should I use responseData from AlamoFire?
public class User: Mappable {
var username: String?
required public init?(map: Map) {
}
public func mapping(map: Map) {
username <- map["username"]
}
}
Alamofire.request(
url,
method: .get,
headers: headers_employees).responseJSON {
response in
let [User] = Mapper<User>().map(JSONString: JSONString)
}
source
share