JSON "object"s are *unordered* (was Re: [squeak-dev] CouchDB was: MySQL question?)

Tony Garnock-Jones tonyg at lshift.net
Tue Jan 12 16:35:24 UTC 2010


Igor Stasenko wrote:
> Is there something what depends on a specific key order?

If there is, it's busted.

>From json.org: "An object is an unordered set of name/value pairs."

>From RFC 4627: "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."

Both quotes are referring to the semantics of the represented values
(the "infoset" if you like), rather than the transfer syntax.

My question is: what motivated the change to using a specific key
ordering when serializing to JSON? From examining MC history, it looks
like Colin Putney introduced the change: Colin, can you comment?

(In particular, since Dictionary>>= operates without regard for order of
key insertion, it must have been something to do with external
representation rather than manipulation of values from within the image.)

Regards,
  Tony
-- 
 [][][] Tony Garnock-Jones     | Mob: +44 (0)7905 974 211
   [][] LShift Ltd             | Tel: +44 (0)20 7729 7060
 []  [] http://www.lshift.net/ | Email: tonyg at lshift.net



More information about the Squeak-dev mailing list