json2html.js

1.0.3 • Public • Published

json2html

This is a repository to build HTML based in json struct

Badges

Github

tag issues contributors license code-size top-languages languages

Social

forks stars watchers

Contributors

Others

BCH compliance

Base Struct

The json payload is as follow:

{
    "tag": "div",
    "attributes": {
        "id": "some-id",
        "class": "some-class"
    },
    "children": [
        //...components or "some-text-or-html"
    ],
}

Restrictions

If the component tag is self closing, content and children will be ignored;

Usage

    var someJson = {};
    JSON2HTML.build(someJson);
    var someHtml = '<div></div>';
    JSON2HTML.unbuild(someHtml);

You can check the example in docs folder.

Contributions

Yes, please! Everybody is welcome.

Package Sidebar

Install

npm i json2html.js

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

34.4 kB

Total Files

11

Last publish

Collaborators

  • guifabrin