dump an object in ejs templates from express3.x views?

I'm using ejs templates with node.js and express 3.x...is it possible to dump a data object passed into view?

Something like this in index.ejs:

<%= dump(session) %>

You can define dump and any other functions for use in views with app.locals:

app.locals.dump = function () {
    // ...
};

One option for this could be to expose util.format() or util.inspect():

app.locals.inspect = require('util').inspect;

Then:

<pre><%= inspect(session) %></pre>