Setup rails to return json responses in json5 format

My project is in Rails 5, and I was fol­low­ing this tuto­r­ial to setup my rails with JSON5 responses. Turns out things have changed a bit.

If you want to avoid the strange dep­re­ca­tion warn­ings when your app runs, the right way to con­fig­ure your app to return data in JSON 5 for­mat is adding the fol­low­ing line to your config/initializers/active_model_serializer.rb file.

ActiveModel::Serializer.config.adapter = :json_api

Ryan Sukale

Ryan is a UX engineer living in San Francisco, California.

You may also like...