@dirkdev/json-to-html
v0.1.2
Published
Simple JSON to HTML converter
Downloads
4
Readme
json-to-html
Simple JSON to HTML converter
Installation
Requires at leas Node 6.x
Install with npm i @dirkdev/json-to-html
Usage
Default export: function(data, opts?)
- data: Object representation of the HTML
- opts: Extra options. Currently none
const json2Html = require('@dirkdev/json-to-html');
const html = json2Html({
key: 'body',
style: {
'background-color': '#9a7ded',
},
children: [{
key: 'ul',
style: {
'list-style-type': 'square',
},
children: [{
key: 'li',
textValue: 'option 1',
}, {
key: 'li',
textValue: 'option 2',
}, {
key: 'li',
textValue: 'option 3',
}],
}],
}, null);
res.write(html);
Develop
- Clone this repo
- npm install
- npm run build
- npm test