{
address:'',
age:'',
client_name:'',
customer_id:'',
first_visit_date:'',
prefecture:'',
}
jsのobjectのキーを自分の指定した、順序に並び替える方法。
//json並び替え key_orderの順番に並び替える
let key_order = ['address','client_name','first_visit_date','prefecture','customer_id','age']
let hash = {}
let items_data = key_order.map(function(x){
return json.items[0][x]
})
for (let [i,j] of zip(key_order,items_data)){
hash[i] = j
}
json.items[0] = hash
参考文献:
https://teratail.com/questions/106913