1.0.7 • Published 9 years ago

json2dom v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
9 years ago

A very simple utility for generating HTML from a JSON. Useful while working with isomorphic apps where you need to share markup between client and server.

var json2dom = require("json2dom");

var json = { 
	tagname:"div",
	attributes:{
		id:"hello",
		class:"world"},
	value:"hello, World",
	children:[
		{
			tagname:"img",
			attributes:{
				src:"hello.png"
			}
		},
		{
			tagname:"p",
			value:"content of child"
		}
	]
	};

var html = json2dom(json);

would create an HTML string like

<div id='hello' class='world'>
	<img src='hello.png'></img>
	<p>content of child</p>
hello, World
</div>
1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago