I am trying to convert JSON to HTML. I am able to create the HTML element and ID attribute. However I can not create the onclick events. I am using the npm json2htmll.js
npm module.
let jsontoHtml: {
"<>": "div",
"html": [
{
"<>": "button",
"id":"button1",
"onclick": "ButtonClicked()",
"text": "Click"
}
]
};
let html = json2html.transform({}, jsontoHtml);
Current output:
</button id="button1">click</button>
Expected output:
<button id="button1" onclick="buttonClicked()">Click</button>
Do you know how I can achieve the expected output?