index array.
var index = ['a','b','c','d'];
Index array can have any number of items.
Result is an associative array with keys as same as index items:
result = [{ b:'Val1', c:'Val2', a:'Val3', d:'Val4' },{ b:'Val5', c:'Val6', a:'Val7', d:'Val8' }];
I have to create another array with keys in same order as of index array.
finalRes = [{ a:'Val3', b:'Val1', c:'Val2', d:'Val4' },{ a:'Val7', b:'Val5', c:'Val6', d:'Val8' }];
Any help will be appreciated. Thanks.