There is also another solution that does not need to be implemented in each answer.
You can define your own hook in the api/hooks folder with the following contents:
var snakeCase = require('snake-case'); module.exports = function (sails) { return { routes: { after: { 'all /*': function overrideJsonx(req, res, next) { var jsonx = res.jsonx; res.jsonx = function (obj) { var res = snakeCase(obj); jsonx(res); }; next(); } } } } };
It will work for all answers without changing the user answers in the api/response folder.
source share