Greetings,
I do have a nested JSON data like this one:
{
"transactions": [{
"18 November, 2019": [{
"title": "Title 01"
}],
"11 November, 2019": [{
"title": "Title 02"
},
{
"title": "Title 03"
}]
}]
}
And would like to access each title as showing below.
Though keys are generating dynamically, so I couldn’t think a way to access them using Template7 features like {{#each transactions.keyName}}.
Any help would be appreciated.
Best,
~ Nathan.
shastox
November 20, 2019, 7:56am
2
https://idangero.us/template7/ вот здесь есть прямо с примерами как пользоваться each
almazk
November 20, 2019, 1:44pm
3
Oh, good old Template7. It will be something like this.
<div class="list">
<div class="list-group">
<ul>
{{#each transactions}}
{{#each this}}
<li class="list-group-title">{{@key}}</li>
<li>
{{#each this}}
<div class="item-content">
<div class="item-inner">
<div class="item-title">{{title}}</div>
</div>
</div>
{{/each}}
</li>
{{/each}}
{{/each}}
</ul>
</div>
</div>
p.s. You could avoid one iteration(each this
), if you convert transactions
from Array
to Object
2 Likes
Great answer @almazk ,
Even though I end up using a different approach, this should be the solution.
Thanks much!