From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Theresa O'Connor" Newsgroups: gmane.emacs.devel Subject: two json.el bugs Date: Fri, 5 May 2017 10:51:44 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1494006767 15972 195.159.176.226 (5 May 2017 17:52:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 5 May 2017 17:52:47 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 05 19:52:44 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 1d6hPH-00044f-JL for ged-emacs-devel@m.gmane.org; Fri, 05 May 2017 19:52:43 +0200 Original-Received: from localhost ([::1]:48364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hPL-0000uP-DO for ged-emacs-devel@m.gmane.org; Fri, 05 May 2017 13:52:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hOj-0000u6-8H for emacs-devel@gnu.org; Fri, 05 May 2017 13:52:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6hOi-0003ON-E5 for emacs-devel@gnu.org; Fri, 05 May 2017 13:52:09 -0400 Original-Received: from mail-it0-x232.google.com ([2607:f8b0:4001:c0b::232]:37405) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d6hOi-0003Nf-9W for emacs-devel@gnu.org; Fri, 05 May 2017 13:52:08 -0400 Original-Received: by mail-it0-x232.google.com with SMTP id x188so12061658itb.0 for ; Fri, 05 May 2017 10:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=n5AWqhkfnTLV+ai1p3GMGgUHky9sVz/0h5c5PWDekLA=; b=eEjYnjai/WTVj/vyZ+zr8VUwKfdUCYBXG8+XC0274il0Iji97ntbY1yBFi3SvvhW6S z+IKgkXDYrPS3YKBZopD+8thKR1BzpEldHgCxb5/2BsLwMEcbl9nw9FBi1O+TqR0Gz76 Nn+5aCq6Qui7wh9xLEFdcxr+uWpXxP9qAHta4rcoDB/O9w8gPQGw1h+khpZ7QdEbc+SM zMXvKvYjCTde2pCwR5mrLvAaanwz6pT/BjaN5buymnrL5AJiHOuiyfi69MB0xAnXVP+8 vwKA3gZEWtW0V9F4bW0u9kCNBN+R3vLtvmzIFOJnjyol9GMIZeNblDAIUjnJAE7m5o6L 8Dew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=n5AWqhkfnTLV+ai1p3GMGgUHky9sVz/0h5c5PWDekLA=; b=kH1to7fBKiNo544W4ZLLK1MP1vp8lp3QvbXyWR/xscF93VBdRfvIIwOWm2bAkfPW6G FGXupFrxe9EIRO1Wyq5E6gW5O0UF7+DKnuaBe5hCYoNpUbxrUNsU8Y0jYQxTE1Tzoypm +qCUWUCnI3gJL2X5XtDGIE1zzb6hWpu+qIme7UI8S6VKPjPlhRxQDIBWo3HzN0XtwlKA g0pIrivacixQ2Gr2gg2c4FBaGNDMNQHh40NGYWbw2JbU0tAM+QL/2t1EZX+ThgzR0h4y m242cNxJxAxUHoIzlkG/MNFgLa1cyptDHk6E5FsaPCZl9GGJgrbRIPB+5fCHs04ya2DP 5hlw== X-Gm-Message-State: AN3rC/4EDwlPdlpHQx044/rCAtF5T3xO8oATakLVKM/53A3dbdvUTOck 7/L0FefEPQ5eh8lmwGP9odowV7ia6Q== X-Received: by 10.36.91.13 with SMTP id g13mr9283444itb.119.1494006725666; Fri, 05 May 2017 10:52:05 -0700 (PDT) Original-Received: by 10.79.164.82 with HTTP; Fri, 5 May 2017 10:51:44 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::232 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:214579 Archived-At: hi all, i wanted to write up two bugs in json.el that i haven't had a chance to fix (in years, ooof). one is super minor and the other might require a bit of thinking to come up with an elegant fix. 1. `json-skip-whitespace' uses a hardcoded list of whitespace characters, which means it fails to skip over other WSpace=Y characters. It should probably use `search-whitespace-regexp' from isearch.el (or an equivalent value from elsewhere) instead. 2. Order of key-value pairs is not explicitly preserved in either the reader or the serializer, and if there are duplicate keys, either the first or the last wins depending on a number of factors. While json objects are technically defined to be unordered (and therefore json.el's current behavior is conforming), the standard JS implementation preserves order and a convention has developed whereby duplicate keys are used to provide "comments", e.g. { "foo": "the foo property is used for blah blah blah.", "foo": 4 } Last key should always win when reading, and order needs to be preserved when serializing so that these "comments" can be generated. This is a fairly serious interoperability issue. thanks, tess p.s. for extra credit, if someone could s/Edward O'Connor/Theresa O'Connor/g everywhere i would really appreciate it.