I am writing back-end to one app and my front-end developer forced me to use small-cap camelCase
notation in JSON files that he is receiving (sic!). With sending him this is no problem because I use Jbuilder
and there is an option to provide such possibility. But how can I parse his responses in simple way? Is there any option to make it automatically instead rewriting all keys using ActiveSupport
String#underscore
method?
Example:
I get request with JSON:
{
'someValue': 324,
'someOtherValue': 'trolololololo'
}
And in Rails land I want use it as follows:
@data = JSON.parse(request.body)
@some_value = @data['some_value'] # or @data[:some_value]