Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically convert between underscores and camelCase #31

Closed
poetmountain opened this issue Jun 16, 2015 · 4 comments
Closed

Automatically convert between underscores and camelCase #31

poetmountain opened this issue Jun 16, 2015 · 4 comments

Comments

@poetmountain
Copy link

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
Copy link
Owner

aryaxt commented Jun 17, 2015

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
Copy link
Author

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
Copy link
Owner

aryaxt commented Jun 21, 2015

This is now available on 2.1, great suggestion.

Thanks

@aryaxt aryaxt closed this as completed Jun 21, 2015
@poetmountain
Copy link
Author

Works great. Thanks for adding it! 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants