嗨我有解析數據的大問題。我有結構是這樣的:解析JSON到數組
<code>
[{
"absent": ["a", "b", "c"],
"against": ["a", "b", "c"],
"club": "club1",
"for": ["a", "b", "c"],
"withhold": ["a", "b", "c"]
}, {
"absent": ["a", "b", "c"],
"against": ["a", "b", "c"],
"club": "club2",
"for": ["a", "b", "c"],
"withhold": ["a", "b", "c"]
}, {
"absent": ["a", "b", "c"],
"against": ["a", "b", "c"],
"club": "club3",
"for": ["a", "b", "c"],
"withhold": ["a", "b", "c"]
}]
</code>
,我需要解析此結構陣列像這樣的:
<code>
array={a,"absent",clube1
b,absent,clube1
c,absent,clube1
a,against,clube1
b,against,clube1
c,against,clube1
a,for,clube1
b,for,clube1
c,for,clube1
a,withhold,clube1
b,withhold,clube1
c,withhold,clube1
a,absent,clube2
b,absent,clube2
c,absent,clube2
a,against,clube2
b,against,clube2
c,against,clube2
a,for,clube2
b,for,clube2
c,for,clube2
a,withhold,clube2
b,withhold,clube2
c,withhold,clube2
}
</code>
等等 任何人可以幫助我嗎?我正在使用純Java腳本。我不能改變這個結構,所以只有一種方法是編寫代碼來排序。感謝您的幫助和對我的英語感到抱歉。
您忘記添加你試過到目前爲止javascript代碼! –
看起來像[Array#reduce](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)的東西,但你的嘗試和問題在哪裏? – Xotic750
爲什麼你所期望的結構在字符串周圍沒有引號? – Barmar