Using the latest version (2.2.2) from https://www.json2html.com to parse JSON to an HTML string. This is working as expected with the string below when I put it in the builder on the website. It also works in an HTML page, but it drops the Javascript event from the HTML element. So what renders on the builder tab as
renders in an HTML page as
The Javascript is here:
let layout = {"<>":"div","id":"mainDiv","html":[{"<>":"div","id":"SALCONTAINER","class":"fieldDivClass","html":[{"<>":"div","id":"SALLABELDIV","class":"labelDivClass","html":[{"<>":"label","type":"","id":"SALLABEL","label-binding":"SAL","html":"Monthly Salary","onclick":"","class":"labelClass"}]},{"<>":"div","id":"SALINPUTDIV","class":"inputDivClass","html":[{"<>":"input","type":"number","id":"SALINPUT","data-binding":"SAL","html":"","onclick":"validate('SAL');","class":"inputClass"}]}]},{"<>":"div","id":"INDCONTAINER","class":"fieldDivClass","html":[{"<>":"div","id":"INDLABELDIV","class":"labelDivClass","html":[{"<>":"label","type":"","id":"INDLABEL","label-binding":"IND","html":"Industry","onclick":"","class":"labelClass"}]},{"<>":"div","id":"INDINPUTDIV","class":"inputDivClass","html":[{"<>":"select","type":"","id":"INDINPUT","data-binding":"IND","html":"","onclick":"validate('IND');","class":"inputClass"}]}]},{"<>":"div","id":"EMPLCONTAINER","class":"fieldDivClass","html":[{"<>":"div","id":"EMPLLABELDIV","class":"labelDivClass","html":[{"<>":"label","type":"","id":"EMPLLABEL","label-binding":"EMPL","html":"Employer","onclick":"","class":"labelClass"}]},{"<>":"div","id":"EMPLINPUTDIV","class":"inputDivClass","html":[{"<>":"textarea","type":"","id":"EMPLINPUT","data-binding":"EMPL","html":"","onclick":"validate('EMPL');","class":"inputClass"}]}]},{"<>":"br","id":"","class":"","html":[{"<>":"div","id":"EMPLLABELDIV","class":"labelDivClass","html":[{"<>":"label","type":"","id":"EMPLLABEL","label-binding":"EMPL","html":"Employer","onclick":"","class":"labelClass"}]},{"<>":"div","id":"EMPLINPUTDIV","class":"inputDivClass","html":[{"<>":"textarea","type":"","id":"EMPLINPUT","data-binding":"EMPL","html":"","onclick":"validate('EMPL');","class":"inputClass"}]}]},{"<>":"div","id":"EMPSTARTDATECONTAINER","class":"fieldDivClass","html":[{"<>":"div","id":"EMPSTARTDATELABELDIV","class":"labelDivClass","html":[{"<>":"label","type":"","id":"EMPSTARTDATELABEL","label-binding":"EMPSTARTDATE","html":"Start Date","onclick":"","class":"labelClass"}]},{"<>":"div","id":"EMPSTARTDATEINPUTDIV","class":"inputDivClass","html":[{"<>":"input","type":"date","id":"EMPSTARTDATEINPUT","data-binding":"EMPSTARTDATE","html":"","onclick":"validate('EMPSTARTDATE');","class":"inputClass"}]}]}]}
//convert JSON to HTML elements string using library from https://json2html.com/
let htmlLayout = json2html.render({},layout);
//put HTML elements string into applicable div
$(div).innerHTML = htmlLayout;