Skip to content

asolis/jquery.json2html-sprintf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery.json2html + sprintf

What is jquery.json2html + sprintf?

jquery.json2html is a jquery plug-in that implements the HTML templating engine json2html for client side browers while using sprintf like-syntax to format the data output.

Ok so what is json2html?

json2html is a javascript HTML templating engine which converts json object to html using json transforms. Note that this jquery.json2html package includes the latest version of json2html.

For more information check out the json2html core library. For more information about the sprintf function

Also implemented in node.js node-json2html

Why json2html?

Instead of writing HTML templates json2html relies on JSON transforms to convert a source JSON objects to html. The benefit of using a JSON transform is that they are already readable by the browser and DO NOT require any compilation before use. In addition, json2html allows the following

  • Short hand notation for mapping data objects to markup
  • Event binding to DOM objects (exclusively with jquery.json2html)
  • Use of inline functions to allow for complex logic during transformation
  • Dynamic building of transform objects
  • Use sprintf like-syntax to format your data

Example of a Transform?

var transform = 
 {"<>":"li","id":"${id}","html":[
	{"<>":"span","html":"${name} ${year} ${salary}.2f"}
  ]};		

Will render into the following html

<li id=1123>
	<span>Jack and Jill (2001) 50000.00</span>
</li>	

Where is the project now?

json2html (and jquery.json2html) have been battle hardened and used in thousands of projects since it's original release in 2012.

How do I start?

Check out our website www.json2html.com for more information including detailed usage notes, downloadable examples and more!

About

jQuery plugin enabling browser support for the html templating engine json2html + sprintf.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 86.4%
  • HTML 13.6%