When comparing swig vs Json2html, the Slant community recommends swig for most people. In the question“What are the best JavaScript templating engines?” swig is ranked 14th while Json2html is ranked 30th. The most important reason people chose swig is:
Available for node.js and major web browsers
Ranked in these QuestionsQuestion Ranking
Pros
Pro Works both on the client and on the server
Available for node.js and major web browsers
Pro Does not hide HTML
Swig does not abstract HTML syntax from you (like e.g. Jade does) giving a certain filling of control over the markup.
Pro Embedded jQuery Events
Allows for jQuery events to be embedded within the template when used on the client.
Pro No special template syntax to learn
Templates are JSON objects that can include javascript functions to render any complex logic.
Pro Portable to server and client
Templates are stored as JSON rather than HTML, easily ported to both client and server.
Cons
Con No updates for at least 6 months
Swig has not received any new commits since June 25 2015.
Con Templates can be hard to read
HTML structure for template replicated in JSON, can be hard to read.