Twig Array to string conversion

You shouldn't really be building complex data structures inside of Twig templates. You can achieve the desired result in a more idiomatic and readable way like this:

{% for status in status_info %}
    <a href="{{ status.link }}" title="{{ status.title }}">{{ status.display }}</a>
    {% if not loop.last %}|{% endif %}
{% endfor %}

info is an array, so you should simple write

{{ info|join(', ') }}

to display your info array.

[info] is a array with one value : the array info.


You can user json_encode for serialize array as strig, then show pretty - build in twig

    {{ array|json_encode(constant('JSON_PRETTY_PRINT')) }}