很明顯,我不能依賴JSON中的鍵值對的排序。例如,JSON解析器可以解釋我可以依賴JSON數組的順序嗎?
{
"someKey" : "someValue",
"anotherKey" : "anotherValue",
"evenAnotherKey" : "evenAnotherValue"
}
爲
{
"anotherKey" : "anotherValue",
"someKey" : "someValue",
"evenAnotherKey" : "evenAnotherValue"
}
合法的,但我可以依靠JSON 陣列的順序?例如,可以一個JSON解析器解釋
{
"arrayKey" : ["firstElement", "secondElement", "thirdElement"]
}
爲
{
"arrayKey" : ["secondElement", "firstElement1", "thirdElement"]
}
合法?我假設沒有,但我的朋友告訴我說我錯了。
你問關於JSON數組,但談論JavaScript編譯器。你在處理JSON還是JavaScript? – Quentin
@Quentin我的意思是一個解析器。我將編輯該問題。 – Bennett