JHson.js - Example - Write JSON as HTML
This is an example of how to convert JSON to HTML, and write it to any HTML DOM element.
Download Now
v2.4.0 - 23rd Jan 2026
This is an example of how to convert JSON to HTML, and write it to any HTML DOM element.
Download Now
var yourDiv = document.getElementById( "your-div" );
$jhson
.html()
.json( "{\r\n \"div\": {\r\n \"h1\": {\r\n \"@id\": \"test-header\",\r\n \"#text\": \"Welcome to JHson.js v2.4.0\"\r\n }\r\n }\r\n}" )
.templateData( {} )
.removeOriginalAttributes( true )
.removeOriginalDataAttributes( true )
.clearOriginalHTML( true )
.addCssToHead( false )
.clearCssFromHead( false )
.logTemplateDataWarnings( false )
.addAttributes( true )
.addDataAttributes( true )
.addCssProperties( true )
.addText( true )
.addChildren( true )
.insertBefore( false )
.write( yourDiv );