How to convert data display format?
I have some data in xml
. I converted those data into json
format. But i have problem in displaying data.
Here is my json
formatted data:
{
"status": "1",
"data": [
{
"@attributes": {
"song": "Elona",
"album": "AL-F-001",
"path": "link1",
"calen": "278",
"dl": "./demo/AL-F-001_Elona.mp3"
}
},
{
"@attributes": {
"song": "Evis",
"album": "AL-F-002",
"path": "link2",
"calen": "279",
"dl": "./demo/AL-F-002_Evis.mp3"
}
},
{
"@attributes": {
"song": "Kozeta",
"album": "AL-F-003",
"path": "link3",
"calen": "280",
"dl": "./demo/AL-F-003_Kozeta.mp3"
}
}
]
}
What i want is like:
{
"status": "1",
"data": [
{
"song": "Elona",
"album": "AL-F-001",
"path": "link1",
"calen": "278",
"dl": "./demo/AL-F-001_Elona.mp3"
},
{
"song": "Evis",
"album": "AL-F-002",
"path": "link2",
"calen": "279",
"dl": "./demo/AL-F-002_Evis.mp3"
},
{
"song": "Kozeta",
"album": "AL-F-003",
"path": "link3",
"calen": "280",
"dl": "./demo/AL-F-003_Kozeta.mp3"
}
]
}
How can i do that? Can anyone help me to solve this?
如何遍历数组并使data [i] = data [i] [“ @ attributes”]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.