From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: two json.el bugs Date: Sun, 28 May 2017 15:12:18 -0700 (PDT) Message-ID: <4054d683-e291-4512-b5c6-1b10997c0d02@default> References: <16aabb87-3130-41b8-968e-52bc5aea3956@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1496009561 1841 195.159.176.226 (28 May 2017 22:12:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 May 2017 22:12:41 +0000 (UTC) To: Philipp Stephani , "Theresa O'Connor" , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 29 00:12:38 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dF6QP-0000ND-WA for ged-emacs-devel@m.gmane.org; Mon, 29 May 2017 00:12:38 +0200 Original-Received: from localhost ([::1]:45463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dF6QV-0007jq-H5 for ged-emacs-devel@m.gmane.org; Sun, 28 May 2017 18:12:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dF6QH-0007iL-Vu for emacs-devel@gnu.org; Sun, 28 May 2017 18:12:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dF6QD-0008FV-19 for emacs-devel@gnu.org; Sun, 28 May 2017 18:12:29 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:24420) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dF6QC-0008F4-OX for emacs-devel@gnu.org; Sun, 28 May 2017 18:12:24 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v4SMCLa3024024 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 28 May 2017 22:12:21 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v4SMCLT5027480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 28 May 2017 22:12:21 GMT Original-Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v4SMCJZa005771; Sun, 28 May 2017 22:12:20 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6767.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215293 Archived-At: > > > 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.) > > =C2=A0 ^^^^^^^^^^^^^^^^^^^^^^^^^ > >=20 > > If you're talking about JSON objects then no, no particular > > meaning or behavior is defined for duplicate fields (keys) > > in a JSON object. > >=20 > > A given application that handles JSON object is free to > > act as you say.=C2=A0 And it is free to act otherwise. >=20 > 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.