aryaxt / OCMapper

Objective-C library to easily map NSDictionary to model objects, works perfectly with Alamofire. ObjectMapper works similar to GSON
MIT License
347 stars 45 forks source link

Automatically convert between underscores and camelCase #31

Closed poetmountain closed 9 years ago

poetmountain commented 9 years ago

I often have to interact with APIs that use underscores in their JSON responses (e.g. 'some_property'). This forces me to do a lot of manual mapping to convert to ObjC/Swift camel case properties (e.g. 'someProperty). It would be fantastic if OCMapper could automatically convert between the two.

aryaxt commented 9 years ago

I'll check it out, if it doesn't bring the performance down will add it. Otherwise you could simply write a category to NSDictionary that loops through all keys and changes them to camel case before passing it to OCMapper, should be quite easy and straight forward

poetmountain commented 9 years ago

That's definitely an option, but since the underscore syntax is pretty common in APIs it seemed worth adding to the library. Thanks for looking into it!

aryaxt commented 9 years ago

This is now available on 2.1, great suggestion.

Thanks

poetmountain commented 9 years ago

Works great. Thanks for adding it! 🍺