-2
如何將以下json轉換爲所需格式?轉換爲prper格式
我有什麼:
{
"1":{
"name":"Room1",
"agegroup":"38 to 67",
"display_agegroup":"Months",
"0":"After School Care"
},
"5":{
"name":"new room",
"agegroup":"3.08 to 4.",
"display_agegroup":"Years",
"0":"After School Care",
"1":"Before School Care"
}
}
我需要什麼:
[{
"id":"1",
"field1":"Room1",
"field2":"38 to 67",
"field3":"Months",
"field4":"After School Care"},
{
"id":"5",
"field1":"new room",
"field2":"3.08 to 4.",
"field3":"Years",
"field4":"After School Care & Before School Care"
}]
請指引我。
你有試過什麼嗎?提示:使用[Object.keys](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys)。 – Beterraba
是嘗試過但沒有結果。 – user3349759