News for hackers. Stuff that matters.
Re:The Pretty JSON Revolution by dragonwriter on Tuesday February 23, 2021 @12:46PM (#26240298)
> The JSON language spec has ORDERED object members.

False. “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.” [emphasis added][0]

[0] https://tools.ietf.org/html/rfc8259

Re:The Pretty JSON Revolution by ucarion on Tuesday February 23, 2021 @01:22PM (#26240720)
Not exactly, unfortunately. The text you cite is in the introduction, which is non-normative. That text talks about the conceptual data model, but that's just to frame the reader's thinking.

The normative text has the "real" answer, and the real answer is that it's basically undefined behavior. It starts by saying "The names within an object SHOULD be unique", and then elaborates:

  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.
https://tools.ietf.org/html/rfc8259#section-4
Re:The Pretty JSON Revolution by dragonwriter on Tuesday February 23, 2021 @01:54PM (#26241225)
> The normative text

Unlike some RFCs, which clearly and explicitly delineate normative from informative material, RFC 8259 does not, but the text you cite is on its face informative rather than normative: it does not specify what an implementation MUST or SHOULD do, or what the object model IS, it describes the variety of preexisting implementations (based, correctly or not, on prior specifications) that are in the wild.

Re:The Pretty JSON Revolution by hyperion2010 on Tuesday February 23, 2021 @01:37PM (#26240961)
This reads like multiple instances of the same name in a json object is undefined behavior and the user will get what they deserve if they try to rely on that behavior.
Re:The Pretty JSON Revolution by gpvos on Tuesday February 23, 2021 @06:03PM (#26244208)
So basically, "it's a free-for-all, we guarantee absolutely nothing unless you 1) don't generate duplicate keys and 2) the code of your consumer doesn't depend on their ordering".
Re:The Pretty JSON Revolution by ucarion on Wednesday February 24, 2021 @04:48PM (#26256506)
Yeah. Maybe it was a bit unclear, but when I used the term "undefined behavior" I think I meant exactly what "free-for-all" means in your sentence.