JR has a few configuration options, though the default settings will work well for most projects. To set configuration options create an initializer and add the options you wish to set. All options have defaults, so you only need to set the options that are different.
You wish to change the way multi word JSON keys are serialized. By default JR uses the JSON API recommendation for dasherizing (
foo-bar) compound words.
Create a new file named
jsonapi-resources.rb in your project’s
config/initializers directory and add the following:
Now override the
route_format to camelize (
fooBar) compound words:
See formatters for more details on formatters.
The default configuration options are shown below:
Note: If using custom classes (such as a
CustomPaginator), be sure to require them at the top of the initializer before usage.