显然,我不能依赖JSON中键/值对的排序。例如,JSON解析器可以解释
{
"someKey" : "someValue",
"anotherKey" : "anotherValue",
"evenAnotherKey" : "evenAnotherValue"
}
Run Code Online (Sandbox Code Playgroud)
如
{
"anotherKey" : "anotherValue",
"someKey" : "someValue",
"evenAnotherKey" : "evenAnotherValue"
}
Run Code Online (Sandbox Code Playgroud)
合法,但是我可以依靠JSON 数组的顺序吗?例如,JSON解析器可以解释
{
"arrayKey" : ["firstElement", "secondElement", "thirdElement"]
}
Run Code Online (Sandbox Code Playgroud)
如
{
"arrayKey" : ["secondElement", "firstElement1", "thirdElement"]
}
Run Code Online (Sandbox Code Playgroud)
合法吗 我以为没有,但是我的朋友告诉我我不正确。