NASA Planetary Mission

    json2html-lib
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.0 • Public • Published

    json2html

    Generation of an HTML plain text from a Json structure with several setting options.

    npm version Downloads MIT license

    Installation

    npm i json2html-lib --save
    
    • 0.0.6 : for View Engine
    • 0.1.0+ : for Ivy

    Requirements

    Only for demo:

    • Angular 13.2.0 and more

    Demo

    See a live demonstation

    Usage

    Examples

    import { Json2html } from 'json2html-lib';
    
    console.log(
        new Json2html(
            {
                tag: 'div',
                attrs: { id: 'test1', class: 'testclasse' },
                body: [
                    'test',
                    {
                        tag: 'div',
                        attrs: { id: 'test2', class: 'foobar' },
                        body: 'test',
                    },
                ],
            },
            { formatting: 'multiline' },
        ).toString(),
    );
    /*
    <div id="test1"
         class="testclasse">
        test
        <div id="test2"
             class="foobar">
            test
        </div>
    </div>
    */

    Publishing the library

    npm run build:lib
    npm run publish
    

    Publishing the demo

    npm run build:demo
    

    License

    This module is released under the permissive MIT license. Your contributions are always welcome.

    Install

    npm i json2html-lib

    DownloadsWeekly Downloads

    17

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    115 kB

    Total Files

    13

    Last publish

    Collaborators

    • zefling