Spacebar template helper for display entire object or array

Hello everyone
I was trying for display the entire object (or some array) in the spacebar template ( of course of debugging purpose).

I wanted to get some quick answers if there is anything equivalent
Somewhat similar to json filter in angularjs template {{ object | json }}

I am not aware of any. Just standard iterating over Object.keys

Came up with some solution:

Template.registerHelper('json', function(a) {
        return JSON.stringify(a);

    }catch(e){return a;}


Usage in the template:

{{ json currentUser }}

Not sure if this is the best way though!


I love it!! It would be quite usefull.