If you are developing an API with Rails you need to rescue from the errors produced by a bad formatted JSON. In order to do that I use a middleware file placed in app/middleware named ParamsParserRescue.rb. classParamsParserRescue<ActionDispatch::ParamsParserdefcall(env)beginsuper(env)rescueMultiJson::DecodeError[400,{},["Bad Request"]]endendend And with this middleware file you need to tell Rails that should use it. In the configuration file application.rb add: config.middleware.swapActionDi...