How to use nested array in email template

I have a nested array that I am passing as templateVar.

setTemplateVars(['details' => $  arr]) 

The array($ arr) is

[0] => [         ["key1"]=>value1         ["key2]=>value2 ] [1]=>[         ["key1"]=>value1         ["key2]=>value2 ] . . . All arrays have same keys. 

I have tried both updates mentioned in How to show array in email template file?

I cannot pass it as a string as the array can be an array of 100s of arrays with same keys.