handlebars-json-beauty
handlebar helper for printing json colorfully
Quick
var handlebars = var jsonBeauty = //initialize json beauty //If your own css to be applied => pass second argument as true as below. //Later You can wirte your own css on hbs template.//jsonBeauty(handlebars,true) //Example json data to be print on htmlvar jsonData = name: 'Earth' order: 3 stats: life: true mass: 59736 * Math name: 'Saturn' order: 6 stats: life: null mass: 56846 * Math ; //pass the json to handlebars compile method as any other varriablevar html = handlebars jsonDataToPrint: jsonData; //use 'jsonBeauty' helper like below in hbs template filejsonBeauty jsonDataToPrint
Complete Sample
how to use 'handlebar-jsonBeauty'
https://github.com/dim912/handlebar-pretty-json/blob/master/sample/sample.js
hbs template
https://github.com/dim912/handlebar-pretty-json/blob/master/sample/index.hbs
Result
https://github.com/dim912/handlebar-pretty-json/blob/master/sample/result.JPG