UNPKG

simple-json-to-html-converter

Version:

"# JSON-to-HTML-Converter, In this Version It Can convert All html elements"

105 lines (97 loc) 2.37 kB
<!DOCTYPE html> <html> <body> <script src="json-to-html-library.js"></script> <script> var data_input = [ { "tag":"h3", "id":"table-head", "class":"table-head", "html":"Top 3 Coders in India" }, { "tag":"table", "id":"sample-table", "class":"table-class", "border":"1", "_child":[ { "tag":"tr", "_child":[ { "tag":"th", "html":"Rank" }, { "tag":"th", "html":"Full Name" }, { "tag":"th", "html":"City" } ] }, { "tag":"tr", "_child":[ { "tag":"td", "html":"1" }, { "tag":"td", "html":"Vinod Selvin" }, { "tag":"td", "html":"Mumbai" } ] }, { "tag":"tr", "_child":[ { "tag":"td", "html":"2" }, { "tag":"td", "html":"Manoj Selvin" }, { "tag":"td", "html":"Bangalore" } ] }, { "tag":"tr", "_child":[ { "tag":"td", "html":"3" }, { "tag":"td", "html":"Binson Selvin" }, { "tag":"td", "html":"Tirunelveli" } ] }, ] } ]; data_input = JSON.stringify(data_input); json2Html('mypage').setJson(data_input); json2Html('mypage').getHtml(function (html) { document.write(html); }); </script> </body> </html>