我想用值替换数组键。这是我的阵列。
[
{"COLUMN_NAME":"ID"},
{"COLUMN_NAME":"project_name"},
{"COLUMN_NAME":"Population"},
{"COLUMN_NAME":"project_id"},
{"COLUMN_NAME":"Date"},
{"COLUMN_NAME":"location"}
]
我希望得到的是像这样的数组
[
{"ID":"ID"},
{"project_name":"project_name"},
{"Population":"Population"},
{"project_id":"project_id"},
{"Date":"Date"},
{"location":"location"}
]
提前感谢。
答案 0 :(得分:1)
您可以使用此代码:
删除yourarray [0]; yourarray.push({ID2: “ID2”});
这个决心。