var accountInfo = []; {% for id, account in accounts %} accountInfo[{{ id }}] = {preferredCurrency: {{ account.preferredCurrency}}}; {% endfor %}