我有以下的JSON對象轉換JSON對象JSON數組附加要素
{
"https://www.google.com": "200",
"https://www.facebook.com": "200",
"https://www.yahoo.com": "401",
"https://www.friendster.com": "404"
}
是否有可能將其轉換爲一個JSON數組在JavaScript中附加元素(URL &狀態)?
[
{
"url": "https://www.google.com",
"status": "200"
},
{
"url": "https://www.facebook.com",
"status": "200"
},
{
"url": "https://www.yahoo.com",
"status": "401"
},
{
"url": "https://www.friendster.com",
"status": "404"
}
]
謝謝你的提示。
**是**。這是可能的。只有你需要編寫一些代碼。添加一些你已經嘗試過的代碼。 – Manwal
迭代現有對象並創建一個新數組。 –