Does JSON syntax allow duplicate values?
这是有效的JSON吗?
1 2 3 4 5 6 | { "a" : [ "x", "x" ] } |
http://jsonlint.com/说是的。
http://www.json.org/没有说禁止它,但确实说:
JSON is built on two structures:
A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
"有序的值列表"表明重复是有效的。 它是否正确? 还有什么更明确的吗? 是否有任何JSON实现不允许重复值?
(这是关于重复键的相关问题。)
这是有效的JSON。 不允许有重复键,例如:
1 2 3 4 | { "a": 1, "a": 2 } |
此外,通过"有序"我相信它指的是值具有预定义的,完善的订单,而不是它们以任何方式排序:)