Print

PRO: twig-tricks

_content, _parent

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

  • _parent
  • _context

note the differnce of _context and _parent loops


twig-Loop with key and value

json with lists (aka arrays) of key:value pairs can be adresses 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 finde 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%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Previous PRO: Basic twig-Syntax
On this page: