• 0

Setup rails to return json responses in json5 format

My project is in Rails 5, and I was following this tutorial to setup my rails with JSON5 responses. Turns out things have changed a bit. If you want to avoid the strange deprecation warnings when your app runs, the right way to configure your app to return data in JSON 5 format is adding the following line to your config/initializers/active_model_serializer.rb file.

ActiveModel::Serializer.config.adapter = :json_api