Open xiaolinghuEr opened 4 years ago
@xiaolinghuEr you can work your way around this by using something like this in your implementation of mapping(map:)
function:
func mapping(map: Map) {
userName <- map["userName"]
if userName == nil {
userName <- map["user_name"]
}
}
Your JSON dictionary:
Your model:
What you expected:
Is there any way to let ObjectMapper support multiple keys for the same property in the Model ? Because the server APIs of different teams may return different fields to represent the same property in App. So there is a strong demand to support this scene. YYModel of Objective-C also support this function.