Skip to content

JS-Void-Packages/void-json-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Json to HTML

Json to HTML is a NodeJS package that let you convert Json to HTML.

What is the format?

To convert your Json, it need to looks like this

{
	"element_name": {
		"class": "test",
		"text": "Hello there"
	}
}

An element name followed by an object of properties. In the example you have an element a with a sub element b with text "Click me". The text part need to be the second lowest key in the object right before another element inside the current element.

how to install it?

npm install void-json-html

how to use it?

const HTML = require('void-json-html')

// can parse a File or an Object
// let obj = HTML.parse('./obj.json')

let obj = HTML.parseObj({
    "a": {
		"class": "button button-red",
		"href": "#test",
		"b":{
			"text":"Click me"
		}
	}
})

console.log(obj)
// should log <a class="button button-red" href="#test"><b>Click me</b></a>

About

Convert Json to HTML.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published