There was an issue opened a few years ago on JsRender to allow looping over objects and not just arrays. One of the examples given that helped to reopen the issue was this:
{
joe:{
name: 'Joe',
status: 'out'},
jane:{
name: 'Jane',
status:'in'},
jill:{
name:'Jill',
status:'away'}
}
Eventually, the feature was implemented but none of the examples I've found address this particular problem, it's always some subset of the data, as in the examples given at the end of the issue thread, usually looking something like this from the docs for for:
[
{
"name": "Pete",
"address": {
"city": "Seattle"
}
},
{
"name": "Heidi",
"address": {
"city": "Sidney"
}
}
]
How can I use for or props to iterate over a dictionary like the one further above? (not an array of objects) Whatever I try I receive the error:
…expected expression, got ':'
Or whatever fits the permutation I try:
{{for :data}}
{{for :#data}}
{{for :}}
etc. It's pretty normal (in my experience) to encounter dictionaries with an index like this in a JSON file so I'm surprised not to find any examples for it.
Any help or insight would be much appreciated.
I'm not using JsViews, just JsRender v0.9.87.