Q:

What is the correct way to "hook" into app.response functions in express? 

I need to way to add some data to app.json and app.jsonp responses in express after app.json is called, what is the correct way to add middleware to this?   I know I could probably do something like:
var jsonTemp = function(status, data) {
  if (! data) {
    data = status;
    status = 200;
  }
  data.extraValue = 'foo';
  res.json(status, data);

}
res.json = jsonTemp;

but monkey patching like that seems like a "bad idea".   Is there an official way to hook into the response with some kind of middleware? 

A:

I think that monkey patching actually might be the best solution without knowing more about what problem you are trying to solve.  The code you showed does however crash the server so don't use that. 
app.use(function (req, res, next) {

  var orig = res.json;
  res.json = function json(status, data) {

    if (! data) {
      data = status;
      status = 200;
    }

    data.extraValue = 'foo';
    orig.call(this, status, data);
  };

  next();
});

Here I'm storing the original function in the variable orig and then delegating to that one when I'm done with the modification.  Your code called your modified function over and over again, since that one now lives under res.json.