var data =
[
{
"id":"07907313",
"type":"car",
"year":"1999"
},
{
"id":"0797096",
"type":"boat",
"year":"2013"
},
{
"id":"2341353",
"type":"plane",
"year":"2015"
}
]
我做
var jsonAsString = JSON.stringify(data);
var jsonData = JSON.parse(jsonAsString);
我想拔出每一個獨特的密鑰(ID,類型,年份)值,並創建另一個變種與格式:
[
{"name": "id", "data": ["07907313","0797096","2341353"]},
{"name": "type", "data": ["car","boat","plane"]},
{"name": "year", "data":["1999","2013","2015"]}
]
我一直在努力獲得我想要的輸出。任何幫助將不勝感激。
您只需要輸出中的unqiue值? – thefourtheye