JTL converts properly formatted JSON into HTML. To install JTL use npm.
Install
npm install @megazear7/jtl
JTL is provided in ESM, CJS, and UMD format. Here is an example:
Example
import { jtl } from '@megazear7/jtl';
const json = {
name: "html",
attr: {
"lang": "en"
},
children: [
{ name: "head" },
{
name: "body",
children: [
{ name: "h1", content: "Hello, World!" }
]
}
]
}
const htmlString = jtl(json).toHtmlString();
// or
const htmlElement = jtl(json).toHtmlElement();
This will output the following html:
Output
<html lang="en">
<head></head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
JTL Playground
Type into the textarea below to see live updates.