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
- Host: GitHub
- URL: https://github.com/segmentio/hbs-json
- Owner: segmentio
- Archived: true
- Created: 2013-12-04T04:59:23.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T23:25:36.000Z (about 3 years ago)
- Last Synced: 2025-01-02T16:37:49.422Z (over 1 year ago)
- Language: JavaScript
- Size: 160 KB
- Stars: 3
- Watchers: 37
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
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 \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
```