4. Objects (对象)
An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A name is a string. A single colon comes after each name, separating the name from the value. A single comma separates a value from a following name. The names within an object SHOULD be unique.
对象结构表示为一对花括号包围零个或多个名称/值对(或成员)。名称是一个字符串。每个名称后面有一个冒号,将名称与值分隔开。单个逗号将值与后续名称分隔开。对象内的名称应该(SHOULD)是唯一的。
object = begin-object [ member *( value-separator member ) ]
end-object
member = string name-separator value
An object whose names are all unique is interoperable in the sense that all software implementations receiving that object will agree on the name-value mappings. When the names within an object are not unique, the behavior of software that receives such an object is unpredictable. Many implementations report the last name/value pair only. Other implementations report an error or fail to parse the object, and some implementations report all of the name/value pairs, including duplicates.
名称全部唯一的对象是互操作的,因为接收该对象的所有软件实现都会对名称-值映射达成一致。当对象内的名称不唯一时,接收此类对象的软件行为是不可预测的。许多实现只报告最后一个名称/值对。其他实现报告错误或无法解析对象,还有一些实现报告所有名称/值对,包括重复项。
JSON parsing libraries have been observed to differ as to whether or not they make the ordering of object members visible to calling software. Implementations whose behavior does not depend on member ordering will be interoperable in the sense that they will not be affected by these differences.
已观察到JSON解析库在是否使对象成员的顺序对调用软件可见方面存在差异。行为不依赖于成员顺序的实现将是互操作的,因为它们不会受到这些差异的影响。