[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: two json.el bugs

From: Drew Adams
Subject: RE: two json.el bugs
Date: Sun, 28 May 2017 15:12:18 -0700 (PDT)

> > > We can't simply serialize/desterialize alists in key order
> > > because the order is reversed in Emacs. (In Emacs alists,
> > > if there are duplicates, the first one wins,
> > > in JSON the last one wins.)
> >   ^^^^^^^^^^^^^^^^^^^^^^^^^
> > 
> > If you're talking about JSON objects then no, no particular
> > meaning or behavior is defined for duplicate fields (keys)
> > in a JSON object.
> > 
> > A given application that handles JSON object is free to
> > act as you say.  And it is free to act otherwise.
> Please see Theresa's initial post why this matters.

It is generally good to preserve the order.  With
that general intention I agree.

What's not true is that "in JSON the last one wins"
when there are duplicates.  JSON itself imposes no
such semantics.

And I question mention of "the standard JS
implementation".  No such thing, AFAIK.

An application can do anything it wants with JSON
data, of course.  In particular, it can if it wants
(but typically would not) depend on the order of
duplicate fields.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]