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> 

http://jsfiddle.net/vduqnhsb/


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -