the following is the data returned by the background
[
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
},
{
"D": 2750000.0,
"": 2142172.1467,
"": 1000000.0,
"": 0.0,
"for": 1000000.0,
"": 9000000.0,
"": 1500000.0,
"W": 2000000.0,
"D": 5100000.0
}
]
I need to put the push of the key order in the object into an array, and the final result
["Cross Star", "leisurely Farm", "Avatar", "Seven six Project", "for".]
because the key of objects returned by for in and Object.keys () are unordered, they can"t get the correct order at all
at present, my idea is as follows: since the returned key is unordered, then simply use the array order obtained by Object.keys to reorganize the returned list
result is still not good. Please tell me what to do
Object.keyscolumns
let columns = [];
let once = []
list.forEach((item, current) => {
columns = Object.keys(item)
})
columns obj
list.forEach(item => {
let obj = {};
columns.forEach(c => {
obj[c] = item[c]
// console.log(obj)
// console.log(c," :",item[c])
})
once.push(obj)
})