{"record":{"id":"f3a43797f5201f62","repo":"balderdashy/sails","slug":"the-2-ary-usage-of-res-json-is-no-longer-suppo","errorCode":null,"errorMessage":"The 2-ary usage of `res.json()` is no longer supported in Express 4/Sails v1.  Please use `res.status(statusCode).json(body)` instead.","messagePattern":"The 2-ary usage of `res\\.json\\(\\)` is no longer supported in Express 4/Sails v1\\.  Please use `res\\.status\\(statusCode\\)\\.json\\(body\\)` instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/router/res.js","lineNumber":299,"sourceCode":"      } catch (e) {\n        if (req._sails && req._sails.log && req._sails.log.error) {\n          req._sails.log.error(e);\n        }\n        else {\n          console.error(e);\n        }\n        res.statusCode = 500;\n      }\n    }//</if data was defined>\n\n    // End the `res` stream.\n    res.end();\n  };\n\n  // res.json()\n  res.json = res.json || function _jsonShim (data, noLongerSupported) {\n    if (!_.isUndefined(noLongerSupported)) {\n      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.');\n    }\n\n    // If data is a string, JSON stringify it.\n    // (Otherwise, we can just rely on `send` to do that for us.)\n    if (_.isString(data)) {\n      data = JSON.stringify(data);\n      res.set('content-type', 'application/json');\n    }\n\n    return res.status(res.statusCode || 200).send(data);\n  };\n\n  // res.render()\n  res.render = res.render || function _renderShim (relativeViewPath, locals, cb) {\n    if (_.isFunction(locals)) {\n      cb = locals;\n      locals = {};\n    }","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/lib/router/res.js#L281-L317","documentation":"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.","triggerScenarios":"Thrown at lib/router/res.js:299 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}