javascript - How can I get object key in a json-file with handlebars -
in following json file:
{ "students":[ { "timestamp": "1,45198e+12", "personnummer": 1234567891011, "fornavn": "some name" } ] }
i'm using handlebars make table out of information, how can go geting "timestamp","personnummer" , forth in <th>
tag.
have tried :
index: {{@index}} value = {{this}}
and: key: {{@key}} value = {{this}}
get: "index: 0 value = [object object]"
can shed light on this?
if
var obj = { "students":[ { "timestamp": "1,45198e+12", "personnummer": 1234567891011, "fornavn": "some name" } ] }
then handlebar should loop:
<ul class="student_list"> {{#each students.[0]}} <li>{{@key}}</li> {{/each}} </ul>
Comments
Post a Comment