You can directly create a new empty array controllersand concathave your controllerNameconvert to an array using a workaround split:''. The result is an array, without additional string manipulation.
{% assign controllers = '' | split: '' %}
{% for operation in menuItems %}
{% assign controllerName = operation.Title | split: '_' | first | split: '' %}
{% assign controllers = controllers | concat: controllerName %}
{% endfor %}
source
share