You should always know with which data type you are working. If you are not
sure, you can always do
$this->template->array = (array) $arrayOrString; which solves
your problem.
I use Latte standalone and the data I use may come in either formats. I've
already made my own filter that does the same you suggested but I thought it
would be better having this built-in.