I’m pulling in a json object, this is the result of a $.parseJSON output. I understand it needs a handler to help it but not to sure what belongs in the helper. Reading the other users questions, they seem to be able to jump through the next hoop due to having a constant key, unfortunately in my case it’s always different.
Json output
[
{
"High blood pressure?": [
"no",
"string"
]
},
{
"Cancer?": [
"no",
"string"
]
},
{
"Asthma or a breathing disorder?": [
"no",
"string"
]
}
]
Loop
{{#each screen_data}}
<tr>
<td class="bold">{{this}}</td>
</tr>
{{/each}}
Results in
[Object object][Object object][Object object]......
It’s because you’ve got an array of objects, and that’s what you’re telling your template to write out.. the object. It seems like you want to write out the only property on the root of the object, which is a question.
try this:
That’s a strange JSON structure you have there, I must say. Generally it’s considered poor form to use the object property name as a carrier of data like that.
EDIT: I’d recommend changing that structure to something that better represents your data… like so:
Which would then mean your template would look like so: