Given a JSON like this:
{
"network":
[
{ "name": [ "John", "Jill", "June" ] },
{ "town": [ "London", "Paris", "Tokyo" ] },
{ "age" : [ "35", "24", "14" ] }
]
}
Unfortunately, my data is in this format and I have to work with it.
I am aiming for an HTML output as below:
<ul>
<li>John, London, is 35 years old.</li>
<li>Jill, Paris, is 24 years old.</li>
<li>June, Tokyo, is 14 years old.</li>
</ul>
(In essence, iterating through the JSON by index - 0, then 1, then 2 :
<ul>
<li>{{name}}[0], {{town}}[0], is {{age}}[0] years old.</li>
<li>{{name}}[1], {{town}}[1], is {{age}}[1] years old.</li>
<li>{{name}}[2], {{town}}[2], is {{age}}[2] years old.</li>
</ul>
)
Is there a built-in method, using handlebarsJS, to create a template like this:
{{#each network}}<li>{{name}}[i], {{town}}[i], is {{age}}[i] years old.</li>{{/each}}
?