In my angular project, I have the array of objects as below. I need to re-arrange the position of the object using javascript / lodash Does anyone help me?
Response (Array of Object):
[
{ 'name': 'MMK', 'desc': 'test descritpion', 'hrcode': 'EMP001' },
{ 'name': 'SSK', 'desc': 'test descritpion', 'hrcode': 'EMP002' },
{ 'name': 'AAK', 'desc': 'test descritpion', 'hrcode': 'EMP002' },
]
Here, I am getting the response as above and that should be changed the order of the keys, not the value.
Expected value
[
{ 'hrcode': 'EMP001', 'name': 'MMK', 'desc': 'test descritpion' },
{ 'hrcode': 'EMP002', 'name': 'SSK', 'desc': 'test descritpion' },
{ 'hrcode': 'EMP002', 'name': 'AAK', 'desc': 'test descritpion' },
]