{
"user_name" : "John Doe"
}
```json
{
"userName" : "John Doe"
}
### Your model:
```swift
class User : Mappable{
var userName : String?
func mapping(map: Map)
{
userName <- map["userName"]
}
}
Is there any way to let ObjectMapper support multiple keys for the same property in the Model ?
This is a good way to support APIs from different enviroments
same question
ObjectMapper does not provide a mechanism for handling this situation. You can easily check if a value was successfully mapped in the mapping function though.
userName <- map["userName"]
if userName == nil {
username <- map["user_name"]
}
Most helpful comment
ObjectMapper does not provide a mechanism for handling this situation. You can easily check if a value was successfully mapped in the mapping function though.