HTML Templating Engine

pure javascript templating

json2html is an open source javascript library that uses JSON templates to convert JSON objects to HTML.

  • jquery plug-in available on web clients
  • node.js package available on web servers

Ask a Question   Contact Us

Try it out!

{'<>':'li','html':'${a} - ${b}'}


    json2html is a javascript HTML templating library used to transform JSON objects into HTML using a another user specified JSON transform. There are two wrappers that allow this library to be used by:

    • jquery as jquery plug-in, and extending the core library to include jquery events
    • node.js as node.js package, to be used on a node.js web server

    Each wrapper uses the same transform, thus allowing for one transform to be written that can be run on either the web client (browser) or web server

    What is a Transform?

    A transform specifies a hierarchy of DOM elements (div, span, etc..). Each name value pairs, or attributes, of the transform object represent the attributes found on the DOM HTML element, with the exception the following reserved attribute names:

    • <> (or tag) specifies the type of DOM element (div, span etc..)
    • html specifies the innerHTML this DOM element will contain inlcuding children
    <ul id="list">
        <li>Bob (40)</li>
        <li>Frank (15)</li>
        <li>Bill (65)</li>
        <li>Robert (24)</li>
    var transform = {'<>':'li','html':'${name} (${age})'};
    var data = [

    Getting Started

    The easiest way to get started is to try out the jQuery wrapper for json2html on your web browser. Check out the interactive examples tab to see how you can start using json2html

    Having a hard time figuring out how to create a transform?
    Use the transform builder below to help encode a HTML markup template into a json transform.

    HTML Template

    JSON Transform

    Convert your JSON objects into a readable visual format.


    Copyright (c) 2016 Crystalline Technologies Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.