Hi I am newbee with handlebars. I looking for a way i can parse html template with mustache code and generate JSON payload from the mustache variable/sections/lambdas used in the template.
for ex if i have my template as:
<html>
<head>
<body>
<table id="a" class="b">
<tr>
<td>
Hi {{customer.firstName}} {{customer.lastName}}
</td>
</tr>
<tr>
<td>
{{#if order.[0].gOrder}}
Grocery order {{order.[0].gOrder.orderId}}
{{/if}}
</td>
</tr>
</body>
</head>
</html>
i should get json for above as :
{
"customer": {
"firstName": "",
"lastName": ""
},
"order": {
"0": {
"gOrder": []
}
}
}
Any help is appreciated!