Loading ...
Sorry, an error occurred while loading the content.
 

object type interop

Expand Messages
  • Mikeal Rogers
    Section 2.2 is short enough I might as well just paste it. 2.2. Objects An object structure is represented as a pair of curly brackets surrounding zero or more
    Message 1 of 2 , Jan 18, 2007
      Section 2.2 is short enough I might as well just paste it.

      2.2. 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.

      object = begin-object [ member *( value-separator member ) ]
      end-object

      member = string name-separator value

      Why is it that "name within an object SHOULD be unique" rather than
      "MUST be unique".

      The problem here is the RFC also does not say whether or not the
      object's name/value list is ordered or unordered, which I believe
      also needs to be noted somewhere in the RFC.

      The SHOULD wording really throws me off, because if they can not be
      unique without violating the RFC then they must be ordered if you are
      to resolve lookups by name in an interoperable way. But I would bet
      than the intended implementation is for them not to be ordered, in
      which case how do you resolve conflicting names? You can't use a
      first or last entry as your rule if they are unordered.

      This means that JSON implementations are either violating the RFC as
      they fail outright on a case that is only recommended in the RFC
      (which some do) or they are resolving the name lookup in an un-
      interoperable way.

      IMHO SHOULD should be changed to MUST, and whether object types are
      ordered or unordered should be called out somewhere in the RFC.

      -Mikeal

      [Non-text portions of this message have been removed]
    • Douglas Crockford
      ... From the introduction of the RFC: An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string,
      Message 2 of 2 , Jan 18, 2007
        > IMHO SHOULD should be changed to MUST, and whether object types are
        > ordered or unordered should be called out somewhere in the RFC.

        From the introduction of the RFC:

        An object is an unordered collection of zero or more name/value
        pairs, where a name is a string and a value is a string, number,
        boolean, null, object, or array.
      Your message has been successfully submitted and would be delivered to recipients shortly.