Skip to content

adamgedney/json-make-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

A small package for converting json to html no matter how deeply nested the objects are. There are a few styling options you can apply.

Download the package from npm: https://www.npmjs.com/package/json-make-html

Installation

npm install -S json-make-html

Quick Start

There is only 1 endpoint in this package:

Convert your JSON object to HTML
make(json,args,function(html){});

Usage:

var jsonMakeHTML = require('json-make-html');
var html = jsonMakeHTML.make(json,args, function(html){});

Note: The callback function is optional. The make method with return the html or pass it through the callback.

Returns

Your JSON object in HTML form according to the options you specified.

Options

var args = {
        separator : ': ',
        iterator : 1,
        wrapper : {
            before : '',
            class : 'jsonhtml',
            elem : 'ul',
            after : ''
        },
        child : {
            before : '',
            class : 'jsonhtml__singlechild',
            elem : 'li',
            titleClass : 'jsonhtml__parent',
            titleElem : 'h3',
            after : ''
        },
        css :{
            title : 'margin: 9px 0 0;color:#BA584C;',
            wrapperElem : '',
            childElem : 'list-style-type:none;',
            childElemNested : 'margin-left: 18px;'
        }

    };

Contributors

Adam Gedney

License

MIT

About

An NPM package for turning JSON into HTML, magically.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published