balderdashy/sails · error
The 2-ary usage of `res.json()` is no longer supported in Ex
Error message
The 2-ary usage of `res.json()` is no longer supported in Express 4/Sails v1. Please use `res.status(statusCode).json(body)` instead.
What it means
Error "The 2-ary usage of `res.json()` is no longer supported in Express 4/Sails v1. Please use `res.status(statusCode).json(body)` instead." thrown in balderdashy/sails.
Source
Thrown at lib/router/res.js:299
} catch (e) {
if (req._sails && req._sails.log && req._sails.log.error) {
req._sails.log.error(e);
}
else {
console.error(e);
}
res.statusCode = 500;
}
}//</if data was defined>
// End the `res` stream.
res.end();
};
// res.json()
res.json = res.json || function _jsonShim (data, noLongerSupported) {
if (!_.isUndefined(noLongerSupported)) {
throw new Error('The 2-ary usage of `res.json()` is no longer supported in Express 4/Sails v1. Please use `res.status(statusCode).json(body)` instead.');
}
// If data is a string, JSON stringify it.
// (Otherwise, we can just rely on `send` to do that for us.)
if (_.isString(data)) {
data = JSON.stringify(data);
res.set('content-type', 'application/json');
}
return res.status(res.statusCode || 200).send(data);
};
// res.render()
res.render = res.render || function _renderShim (relativeViewPath, locals, cb) {
if (_.isFunction(locals)) {
cb = locals;
locals = {};
}View on GitHub (pinned to 7b76422cc2)
When it happens
Trigger: Thrown at lib/router/res.js:299 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of balderdashy/sails@7b76422cc2 (2026-09-01).
Data as JSON: /api/errors/f3a43797f5201f62.
Report an issue: GitHub.