2014-02-20 127 views
0

我與格式化這樣如何獲得陣列進行陣列

[ 
[{ 
    "ID": "f75d414d-55fc-43c8-a24d-34eca67913b7", 
    "Revision": "a8c73a24-d46a-47c8-825e-511b26485e23", 
    "type": "Hello", 
    "Stage": null, 
    "label": null, 
}, 
{ 
    "ID": "f75d414d-55fc-43c8-a24d-34eca67913b7", 
    "Revision": "a8c73a24-d46a-47c8-825e-511b26485e23", 
    "type": "world", 
    "Stage": null, 
    "label": null, 
}] 
] 

陣列的工作,我需要轉換到這個

[{ 
    "ID": "f75d414d-55fc-43c8-a24d-34eca67913b7", 
    "Revision": "a8c73a24-d46a-47c8-825e-511b26485e23", 
    "type": "Hello", 
    "Stage": null, 
    "label": null, 
}, 
{ 
    "ID": "f75d414d-55fc-43c8-a24d-34eca67913b7", 
    "Revision": "a8c73a24-d46a-47c8-825e-511b26485e23", 
    "type": "world", 
    "Stage": null, 
    "label": null, 
}] 

通過保存的變量(原始數組)以某種方式。一個光滑的方式會很好。

+1

只要做'arrayName = arrayName [0]' – tewathia

+2

你基本上是問如何訪問數組的第一個元素。這應該[由任何JavaScript教程覆蓋](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Predefined_Core_Objects#Referring_to_Array_Elements)。 –

+0

'var a = [[{ID:...},{ID:...}]] [0];' – RobG

回答

1

關閉我的頭頂不會originalArray = originalArray[0]保存內部數組回到原來的變量?