Print

PRO: twig-tricks

_content, _parent

The “root node” of a JSON loaded into twig can be addressed with two keywords:

  • _parent
  • _context

note the difference of _context and _parent loops


twig-Loop with key and value

JSON with lists (aka arrays) of key:value pairs can be addressed by

{% for key, val in oprs) %}...{% endfor %}

see more here


twig: Handle dash in JSON

If JSON contains some dashes (“-“) in the keys, the usual way of twig does not work.
Here you will find how to solve this.


Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
On this page: