🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

json_html_parser

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json_html_parser

This is a HTML parser,takes json object as input and converts it to html string

1.0.4
latest
Source
npm
Version published
Weekly downloads
3
-75%
Maintainers
1
Weekly downloads
 
Created
Source

This is a HTML parser,takes json object as input and converts it to html string.

The JSON object needs to be of type

interface IHtmlJson{
    tag:string;
    value:string ;
    type:string; //can string,number etc.
    children?:IHtmlJson[],
    css:string;
}

Example JSON object.

    const completeStub = [{
        type: "",
        tag: "div",
        children: [{
            type: "",
            tag: "h3",
            children: null,
            css: "color:blue;",
            value: "I am just awesome"
        }],
        css: "color:blue;",
        value: null
    }, {
        type: "",
        tag: "h1",
        children: null,
        css: "color:red;",
        value: "This has the some value in it."
    }, {
        type: "",
        tag: "h2",
        children: null,
        css: "color:blue;",
        value: "This has the some less value in it."
    }];

    let parser = new Parser(completeStub); 
    let html_string = parser.parse(completeStub);

    // Result 

    /** <div style="color:blue;"  >  
    * <h3 style="color:blue;"  > I am just awesome</h3> 
    * </div> 
    * <h1 style="color:red;"  > This has the some value in it.</h1> 
    */ <h2 style="color:blue;"  > This has the some less value in it.</h2> 

This project is part of SHUKSHMA, it is a microservice framework, with automated code generation, please have a look and if possible give your reviews at mayurtikundi12@gmail.com .

Keywords

library

FAQs

Package last updated on 27 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts