An open API service indexing awesome lists of open source software.

https://github.com/segmentio/hbs-json

Handlebars helper for JSON.stringify
https://github.com/segmentio/hbs-json

Last synced: 9 months ago
JSON representation

Handlebars helper for JSON.stringify

Awesome Lists containing this project

README

          

# hbs-json

Handlebars helper for `JSON.stringify`.

## Installation

$ npm install hbs-json

## Example

```js
var json = require('hbs-json');
var hbs = require('hbs');

hbs.registerHelper('json', json);

app.get('/', function (req, res, next) {
res.render('index.html', { user: req.context.user });
});
```

```html

window.user = {{{ json user }}}

```

## API

### json obj [escaped]

A handlebars helper for `JSON.stringify`. By default, will escape html characters so that you may use handlebars to render values to the template.

## License

```
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
```