Array Insert at index not working

@Teodor @patrick , can you advise if I can use the array or variable components (client-side) to build an array of objects (not sure if this is what is called a “keyed array”)?

What I want is something like this at the end:

arr1 =  
[ 
    { "order1" : {"productid" : "121",   "producttype": "metal"}},
    { "order2" : {"productid" : "122",   "producttype": "paper"}},
    { "order3" : {"productid" : "123",   "producttype": "rock"}},
    { "order4" : {"productid" : "124",   "producttype": "scissor"}}
]

and I want to access each object like this

obj1 = arr1.items["order1"]
obj2 = arr1.items["order2"] 
obj3 = arr1.items["order3"]

and display the object properties further like this in para elements -

obj1.productid
obj1.producttype

Basically, I want to not use “index” but rather use “key”.

Really lost here! Should I be using the custom formatter that @George referred to in his post here How to handle translations, site w multiple languages

<script>
dmx.Formatters('array', {
		toKeyedObject: function(array, key, value) {
			var newObj = {};
			for (var ai=0; ai < array.length; ai++) {
				newObj[array[ai][key]] = array[ai][value];

			}
			return newObj;
  }
 });
</script>