[Haskell-cafe] Ordered JSON objects?

Richard A. O'Keefe ok at cs.otago.ac.nz
Tue Dec 16 23:12:00 UTC 2014

On 16/12/2014, at 9:39 pm, Tobias Dammers <tdammers at gmail.com> wrote:
> No, that's not what I meant. By "ordered", I meant that the in-memory
> representation of the document should maintain file order.

You did consult RFC 4627, right?

Page 1: "An object is an UNORDERED collection of
zero or more name/value pairs”.

Or www.json.org?

Just above the railroad diagram for objects,
“An object is an UNORDERED SET of name/value pairs.”

Or RFC 7159?
Section 1: “An object is an UNORDERED collection of
zero or more name/value pairs”.
The new thing in RFC 7159 is
"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.”

That is, the file order is WITHOUT SIGNIFICANCE.
If you happen to use a library that preserves that order
want your software to be interoperable.

Recall that JSON is explicitly derived from Javascript and
that a JSON “object” is explicitly (www.json.org)
"an object, record, struct, dictionary, hash table, keyed list,
or associative array” so that the *intended* in-memory
representation for a JSON object is an *unordered* data

So if you depend on the order of the name/value pairs in
a JSON object, you doing something surpassing strange and

More information about the Haskell-Cafe mailing list