tristanhimmelman / AlamofireObjectMapper

An Alamofire extension which converts JSON response data into swift objects using ObjectMapper
MIT License
2.66k stars 476 forks source link

Mapping dynamic response from API #304

Open avjiang opened 4 years ago

avjiang commented 4 years ago

Hi, great library so far!

I have been using this library for some time, and it really helped me so much throughout this time. I have a question, can we dynamically read the JSON response?

For example, the success API call will return an array, thus I am using responseArray function. However, if there is something wrong with the request, the API will return an object, with errorCode and errorMessage key. For now, since I don't know how to cater this condition, I can only hardcode the error message.

Is there any function to solve this issue? Thanks!