@mac
To get HTML from JSON data using Mustache, you need to use a template that defines the structure of the HTML output you want to generate.
1 2 3 4 5 |
{ "name": "John Doe", "age": 30, "email": "[email protected]" } |
1 2 3 |
<p>Name: {{name}}</p> <p>Age: {{age}}</p> <p>Email: {{email}}</p> |
1 2 3 4 5 6 7 8 9 |
var data = { "name": "John Doe", "age": 30, "email": "[email protected]" }; var template = "<p>Name: {{name}}</p><p>Age: {{age}}</p><p>Email: {{email}}</p>"; var html = Mustache.render(template, data); |
You can then insert this HTML into your webpage or use it in any other way you need.