nunjucks set create object
<p>As nunjucks now supports using <a href="https://mozilla.github.io/nunjucks/templating.html#set" rel="nofollow">set as a block</a> I wanted to do something like this:</p>

<pre><code>{% set navigationItems %}
  {% for item in items %}
    { name: item.name, url: item.url }{% if not loop.last %},{% endif %}
  {% endif %}
{% endset %}
</code></pre>

<p>Then call this variable as the input object on another macro, like so:</p>

<pre><code>{{ navigation(items=[navigationItems]) }}
</code></pre>

<p>However, <code>navigationItems</code> is evaluated as a string, not an array-literal. Any idea how, or if this is possible?</p>

<p>Thanks.</p>