From unknown Fri Aug 15 02:04:48 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#24252 <24252@debbugs.gnu.org> To: bug#24252 <24252@debbugs.gnu.org> Subject: Status: 25.1; json.el doesn't distinguish null and empty object Reply-To: bug#24252 <24252@debbugs.gnu.org> Date: Fri, 15 Aug 2025 09:04:48 +0000 retitle 24252 25.1; json.el doesn't distinguish null and empty object reassign 24252 emacs submitter 24252 Yoichi Nakayama severity 24252 normal tag 24252 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 17 11:35:10 2016 Received: (at submit) by debbugs.gnu.org; 17 Aug 2016 15:35:10 +0000 Received: from localhost ([127.0.0.1]:60424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba2s2-0003pL-Jb for submit@debbugs.gnu.org; Wed, 17 Aug 2016 11:35:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba2FS-0002mu-6z for submit@debbugs.gnu.org; Wed, 17 Aug 2016 10:55:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ba2FJ-0003O3-7l for submit@debbugs.gnu.org; Wed, 17 Aug 2016 10:55:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba2FJ-0003Mf-5M for submit@debbugs.gnu.org; Wed, 17 Aug 2016 10:55:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba2FG-0003M0-Li for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2016 10:55:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ba2FB-0003JM-FP for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2016 10:55:06 -0400 Received: from mail2.asahi-net.or.jp ([202.224.39.198]:29154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba2FA-0003J8-Tk for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2016 10:55:01 -0400 Received: from gizaemon.local (ab154117.dynamic.ppp.asahi-net.or.jp [183.76.154.117]) by mail2.asahi-net.or.jp (Postfix) with ESMTP id A7A93C7FCC for ; Wed, 17 Aug 2016 23:54:58 +0900 (JST) From: Yoichi Nakayama To: bug-gnu-emacs@gnu.org Subject: 25.1; json.el doesn't distinguish null and empty object Date: Wed, 17 Aug 2016 23:54:02 +0900 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (barebone) [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 17 Aug 2016 11:35:09 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello, When json-pretty-print applied to "{}", it is unexpectedly converted to "null". This is caused by internal representations of null and empty object are the same: (json-read-from-string "{}") ; => nil (json-read-from-string "null") ; => nil ;; Based on the fact that ;; (let ((json-object-type 'hash-table)) ;; (json-read-from-string "{}")) ;; is non-nil, there was a workaround in the past. ;; The current json-pretty-print bind it to alist ;; to keep ordering of elements, so the technique ;; no longer works. Following patch make json.el to treat empty object and null differently and solve the issue. -- Yoichi Nakayama >From 6b0ec686dab49be2309ed2dd349e31695b7cc6f2 Mon Sep 17 00:00:00 2001 From: Yoichi Nakayama Date: Wed, 17 Aug 2016 01:18:56 +0900 Subject: [PATCH] Distinguish empty json object and null * lisp/json.el (json-empty-object): New variable. (json-new-object, json-add-to-object, json-read-object, json-encode): Use it. --- lisp/json.el | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index fdac8d9..ec2c06a 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -89,6 +89,12 @@ If this has the same value as `json-null', you might not be able to tell the difference between `false' and `null'. Consider let-binding this around your call to `json-read' instead of `setq'ing it.") +(defvar json-empty-object :json-empty-object + "Value to use when reading JSON `{}'. +If this has the same value as `json-null', you might not be able to tell +the difference between `{}' and `null'. Consider let-binding this +around your call to `json-read' instead of `setq'ing it.") + (defvar json-null nil "Value to use when reading JSON `null'. If this has the same value as `json-false', you might not be able to @@ -442,7 +448,7 @@ Please see the documentation of `json-object-type'." (cond ((eq json-object-type 'hash-table) (make-hash-table :test 'equal)) (t - ()))) + json-empty-object))) (defun json-add-to-object (object key value) "Add a new KEY -> VALUE association to OBJECT. @@ -454,7 +460,9 @@ Please see the documentation of `json-object-type' and `json-key-type'." (cdr (assq json-object-type '((hash-table . string) (alist . symbol) (plist . keyword)))) - json-key-type))) + json-key-type)) + (object (cond ((eq object json-empty-object) ()) + (t object)))) (setq key (cond ((eq json-key-type 'string) key) @@ -501,10 +509,12 @@ Please see the documentation of `json-object-type' and `json-key-type'." (signal 'json-object-format (list "," (json-peek)))))) ;; Skip over the "}" (json-advance) - (pcase json-object-type - (`alist (nreverse elements)) - (`plist (json--plist-reverse elements)) - (_ elements)))) + (cond ((eq elements json-empty-object) elements) + (t + (pcase json-object-type + (`alist (nreverse elements)) + (`plist (json--plist-reverse elements)) + (_ elements)))))) ;; Hash table encoding @@ -697,6 +707,7 @@ Advances point just past JSON object." "Return a JSON representation of OBJECT as a string." (cond ((memq object (list t json-null json-false)) (json-encode-keyword object)) + ((eq object json-empty-object) "{}") ((stringp object) (json-encode-string object)) ((keywordp object) (json-encode-string (substring (symbol-name object) 1))) -- 2.8.1 From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 18 22:06:59 2016 Received: (at 24252) by debbugs.gnu.org; 19 Aug 2016 02:06:59 +0000 Received: from localhost ([127.0.0.1]:33698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baZD0-0005RE-S8 for submit@debbugs.gnu.org; Thu, 18 Aug 2016 22:06:59 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:36594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baZCy-0005R1-U8 for 24252@debbugs.gnu.org; Thu, 18 Aug 2016 22:06:57 -0400 Received: by mail-lf0-f50.google.com with SMTP id g62so23430112lfe.3 for <24252@debbugs.gnu.org>; Thu, 18 Aug 2016 19:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=5Tq8TH9DgI3AJ2ILqZvR13eI6tm009QKsZfUab64t44=; b=of938Hmw6tK8LFgXD29K2DdUJ7NnqgKIpGv9xHmm63mAFA8RyC1BF0IPeHwOxM1PBs MRmf8P2+DYGpLjt7m8UUMxSlBFKl0ae0OcyGjjfKD9FOfKzp3RRtM7Gs2tSD1cEOCBbS nEu3m1qdhs2uZzu73VgQOAknBulNyuyGLsuCFD1yBKgyYEhXMnn01uc1isuath1o1xMY WXHJVLV1lTyUceWqFGdTo9XBFdbVGBkrBFpM7tDwPz2gfoePpyhaI8gnZhbvQ+Pn38ch 1wQ4KG3PiDPH9C09JGIctqXkJ0wPe/CO0p0PyEg2QAZSqV8WY61rS1THoLSScXeRKKBe CmsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=5Tq8TH9DgI3AJ2ILqZvR13eI6tm009QKsZfUab64t44=; b=L0CpudIa3eeSgLzwbDBBE1QOAIUsV1p9FbSeykp+iGMJ5D0VxVHIya4BJZDgHR+QWQ epC67JCT3rd0KatHpKXL7/rXF2Ka6RGDam7ofvUcqFTJjOjxnmjyGrBPnlRaW3Of0AVg W733+kP7e1YTYpJ7deK2HvmHMfTktKoV/jO0i3dFhe29XuQKrZZDEqZBR2daCk6IkDIU anipXBDny1+Ati8/kosL79Yx1lnvFo2a0FsrNRK4AfXki0S3MfTLmj8hgh449pexBIBL cwpjk5S3KG4VFuW2GxMUopHA6Cfxb59ZDw5uRaIYyfX1QVqjMOfDrs8t28SlEi0nDaQS D4AQ== X-Gm-Message-State: AEkoouvNKBR8PeBUt3HBkvxKfWhsnuMSRxmZc2ha7tgB4FrMh8abVsGXpwVO5RxE2WqYQg== X-Received: by 10.25.16.162 with SMTP id 34mr1553528lfq.127.1471572410878; Thu, 18 Aug 2016 19:06:50 -0700 (PDT) Received: from [192.168.1.190] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id p128sm784838lfb.32.2016.08.18.19.06.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Aug 2016 19:06:50 -0700 (PDT) Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Yoichi Nakayama , 24252@debbugs.gnu.org References: From: Dmitry Gutov Message-ID: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> Date: Fri, 19 Aug 2016 05:06:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 24252 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Hi! On 08/17/2016 05:54 PM, Yoichi Nakayama wrote: > When json-pretty-print applied to "{}", it is > unexpectedly converted to "null". > This is caused by internal representations of null > and empty object are the same: > (json-read-from-string "{}") ; => nil > (json-read-from-string "null") ; => nil Why don't you bind json-null to whatever value you need? Then the results will be different: ELISP> (let ((json-null 'NULL)) (json-read-from-string "null")) NULL > +(defvar json-empty-object :json-empty-object > + "Value to use when reading JSON `{}'. > +If this has the same value as `json-null', you might not be able to tell > +the difference between `{}' and `null'. Consider let-binding this > +around your call to `json-read' instead of `setq'ing it.") This doesn't look like a good default value, at least. It's not one of the types that we parse JSON objects to (alist, plist, hash-table). This will break real code. By the way, another option to distinguish nil and {} is to bind json-object-type to `hash-table'. An empty hash table is not nil. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 19 19:45:26 2016 Received: (at 24252) by debbugs.gnu.org; 19 Aug 2016 23:45:26 +0000 Received: from localhost ([127.0.0.1]:34571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1batTa-0007p5-HE for submit@debbugs.gnu.org; Fri, 19 Aug 2016 19:45:26 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:37491) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1batTY-0007os-CL for 24252@debbugs.gnu.org; Fri, 19 Aug 2016 19:45:24 -0400 Received: by mail-it0-f52.google.com with SMTP id f6so38242592ith.0 for <24252@debbugs.gnu.org>; Fri, 19 Aug 2016 16:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sw3P+WDxBjwG81KeRMOJZN81wAUdcR9QtitHBMwblEg=; b=VfBcGvvvZYwZMuvJT9cjBfv9gBrYGjBxmi9WEoiH8L4ChJlFe4EzdWMppjPQVXu4Is 7RetYcp6idOk/ZxFIk0ud3w/tKIKZWekNNDvOjnUM1QsHO2/iPgfl+/5eeusa6qm0nEA 3wHoa0V1ywK8X/1aUXyQYWuMEui52ZwdyDzh1QlLzQjBXABHZQUhP22yBnEr7wVs4mW1 NtFAI7AKxbXSDq7m2hPHiNHPN+4/OZ8X0cbZjhwPssXmYWaM7V0e4YhDwVO85rmuDmPl TXyM7OmPGnnqwD3GRcMh2Aw17XWufQ3qJDWPkhy/kNklEt7LSAqr4eyYa5AM5IZ7Op2t VjLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sw3P+WDxBjwG81KeRMOJZN81wAUdcR9QtitHBMwblEg=; b=hcYwX2iy/auZlUTclMRX1w0Z5124L65l/av23nh7Eh10WzI0Macfi+C/y/FxGbDfMu anztSrqWw28wydBfBAUqzXg7QcfO46bJyjpZsfOXvR90vbfTN4oWem2ZXvn1rPj60y19 pnCEGnjX1xrOwGbiTA5Xm1BIbszgyC9doYu60d2IFWW2rFDsEvV/ZunUbCfH9upS2qaP v8ffQcaPiHSxGPnPcR/M56TA4Pwp06iQISdrfinhEAjdN6rgy7VKlW0QqvTIMzPh0oxR kRHOBKnp3CBARq5qOupIXIQGnapeoYXOPdVkoYY18uiBD/BU82rJQgYls48At6W17TXL onLg== X-Gm-Message-State: AEkoous3TxLpfmuJORO3RqpPhFq7Tue39i0D9m2OuoMIZsz7eYVw/+l8ObAGmOhd4loPHzl0LfPPeqsM22ZXWg== X-Received: by 10.36.33.17 with SMTP id e17mr9379151ita.41.1471650318709; Fri, 19 Aug 2016 16:45:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.3.18 with HTTP; Fri, 19 Aug 2016 16:45:18 -0700 (PDT) In-Reply-To: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> From: Yoichi Nakayama Date: Sat, 20 Aug 2016 08:45:18 +0900 Message-ID: Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Dmitry Gutov Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > Why don't you bind json-null to whatever value you need? (let ((json-null 'NULL)) (json-encode (json-read-from-string "{}"))) "\"nil\"" > By the way, another option to distinguish nil and {} is to bind json-object-type to `hash-table'. An empty hash table is not nil. It does not work because json-pretty-print overwrites json-object-type. On Fri, Aug 19, 2016 at 11:06 AM, Dmitry Gutov wrote: > Hi! > > On 08/17/2016 05:54 PM, Yoichi Nakayama wrote: > >> When json-pretty-print applied to "{}", it is >> unexpectedly converted to "null". >> This is caused by internal representations of null >> and empty object are the same: >> (json-read-from-string "{}") ; => nil >> (json-read-from-string "null") ; => nil > > > Why don't you bind json-null to whatever value you need? Then the results > will be different: > > ELISP> (let ((json-null 'NULL)) (json-read-from-string "null")) > NULL > >> +(defvar json-empty-object :json-empty-object >> + "Value to use when reading JSON `{}'. >> +If this has the same value as `json-null', you might not be able to tell >> +the difference between `{}' and `null'. Consider let-binding this >> +around your call to `json-read' instead of `setq'ing it.") > > > This doesn't look like a good default value, at least. It's not one of the > types that we parse JSON objects to (alist, plist, hash-table). This will > break real code. > > By the way, another option to distinguish nil and {} is to bind > json-object-type to `hash-table'. An empty hash table is not nil. -- Yoichi NAKAYAMA From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 19 20:52:40 2016 Received: (at 24252) by debbugs.gnu.org; 20 Aug 2016 00:52:40 +0000 Received: from localhost ([127.0.0.1]:34582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bauWd-0000vG-5L for submit@debbugs.gnu.org; Fri, 19 Aug 2016 20:52:40 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:34598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bauWb-0000v0-Lv for 24252@debbugs.gnu.org; Fri, 19 Aug 2016 20:52:38 -0400 Received: by mail-lf0-f47.google.com with SMTP id l89so43461694lfi.1 for <24252@debbugs.gnu.org>; Fri, 19 Aug 2016 17:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=MR+tzzRoJh6eRatfLfSsnpZ6kfV2MBC2pOwdQp+FFM0=; b=K+5l2IFwtuzlTh7GhHXgc9bzwQsbh9Bgp3/ZbAHnzW8P4TQa5G2sRPBfBnpPwg267Q 5sa58UBWG8GwG1QlIqvnQSRdZkcLv9eSVHSP+8U6cdOYyXIXKFfH09aoGl6OIG+WtwPp YH483054U9x9slQydUpdiZuG119mMcowGEV02toSoW/0RZudfFVbjw290AVtuiIJyq42 4maWhcjxk8CYwNzPoVGH2y2G6pBZ9Pf+yMkcrqJf8ii9ij7gD7r4ddKPFVwKr0Zj14Yj fj8xWiIdo1LcIzYS9IJKdO0SrBpZlOaGNHb1SJEnsmkbuunK5aUPVdHtGneWsuUVAAIr /Evg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=MR+tzzRoJh6eRatfLfSsnpZ6kfV2MBC2pOwdQp+FFM0=; b=G3oGGrjsNec5Oe2wDZoIHlAdJG/J8J8eP0NKsqGcaINPLqolQDWbBWS+NwzTq7/Nfb WtMhIsNkXb8JpLd1co8w+7pmOK/HF5aSCsGw4DNsKJxmhmm19FegFbDJr+UIjKVE0gH8 PfljzsrbuLm0F3fMj0ySTec5xtNVCpNkq/LAqUd8eSMGnazCa5s4XmBAGC3zjiDJAi3p bhAw1RKCQ2jFGAvlp6Pghy5HgC7s5Iwlr13u/FExZDxUlCGAv02Bekz1mzJGx4TTsy7+ xDYW2LbWTAcHGv/Vguonri2uPZu46q0LnPiahsG+2JBCo9zGY44EqJGaE4ESXmZIhZv4 ijWw== X-Gm-Message-State: AEkoouvJuILPqNd6ZUHHlPiPiy+8v+Thg+CixFQZL4qRA6mzbFZqEFICXhjlzBZVLC1i0g== X-Received: by 10.25.205.137 with SMTP id d131mr2856192lfg.189.1471654351589; Fri, 19 Aug 2016 17:52:31 -0700 (PDT) Received: from [192.168.1.190] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id h65sm1638317lji.29.2016.08.19.17.52.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Aug 2016 17:52:30 -0700 (PDT) Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Yoichi Nakayama References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> From: Dmitry Gutov Message-ID: Date: Sat, 20 Aug 2016 03:52:29 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) On 08/20/2016 02:45 AM, Yoichi Nakayama wrote: >> Why don't you bind json-null to whatever value you need? > > (let ((json-null 'NULL)) (json-encode (json-read-from-string "{}"))) > "\"nil\"" Okay then: ELISP> (let ((json-object-type 'hash-table)) (json-encode (json-read-from-string "{}"))) "{}" >> By the way, another option to distinguish nil and {} is to bind json-object-type to `hash-table'. An empty hash table is not nil. > > It does not work because Where/how doesn't it work? > json-pretty-print overwrites json-object-type. Maybe the fix could be in json-pretty-print. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 20 02:12:40 2016 Received: (at 24252) by debbugs.gnu.org; 20 Aug 2016 06:12:40 +0000 Received: from localhost ([127.0.0.1]:34624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bazWK-00009F-E2 for submit@debbugs.gnu.org; Sat, 20 Aug 2016 02:12:40 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:33932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bazWJ-000092-PT for 24252@debbugs.gnu.org; Sat, 20 Aug 2016 02:12:40 -0400 Received: by mail-io0-f177.google.com with SMTP id q83so67560688iod.1 for <24252@debbugs.gnu.org>; Fri, 19 Aug 2016 23:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=c4ouqfb8mrtWfRK0uOESjBXWVmMbavR5lHX4GqYL6VM=; b=iY+Z4461TDA0Ahijc+9g7xi28ZMfGGebBb1qinQ/oq3QRrTa1z3XON8TXf6BUzINKY jgyroVHsBxNi1NF+T8i7P5z9bdtJ/OFslsIqChab4p/iTNIu3FAev6WRzNdr49r9AlLK CwIOPnk+uJN2spcvqQDmLx9JlEXTqQ9G5xNSig9otyWNsMX7Z7foaP7bSd8rrEaLq1WH fSfkNkh9StKUHKLNsOvnh7FOLm/ZCrzC858rjuIX3D6nJRCVBHZ9sDCXBlwQmsrFdFSl YFYLggZbXf6679EozUyQjEcA/FGB3PW4AdPUByV9wWF6IAAsJaen7TIBvVUEXWuNcyXN Lh0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=c4ouqfb8mrtWfRK0uOESjBXWVmMbavR5lHX4GqYL6VM=; b=d/Le6ZvL1HDSdjusYiAYgPRgCPaEyHnBqjG/P5RGSQoFn18EroqIWq2Ti8u/km7EhQ C9pgDE4IGuiLD+1160TMTCITLoW5R3N8ANi5XcX0sSArsGpNhdB/8pIMiu9Y0q0AzpHk HtE2FlYlKzdqqe7MP2rsyJE5LnPQpIIbPoCjgK4wIZtppJBwamp3mLgArrC68d1oVBt6 fOqhgOWAEgCi4Dzoaa1utVzMRmznpgx43MfZiTn/jLrRxIbUI7q02+x9K+5qIsus9vGJ xmugz81YUdq8jtQdFW7CHMHP3RxSK5sf62uSo2rPSK8AuR1SB0gu4+PSutWqn9IrlRTy 97XA== X-Gm-Message-State: AEkoouuV7H2X6jOSDJYUkyUC4bSjSU6QnhmwmfAM6HPyrYKW+AotyLm9lvM05HR+fwg7lSwB58o9gCfh/98FTg== X-Received: by 10.107.57.215 with SMTP id g206mr14605742ioa.194.1471673554205; Fri, 19 Aug 2016 23:12:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.3.18 with HTTP; Fri, 19 Aug 2016 23:12:33 -0700 (PDT) In-Reply-To: References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> From: Yoichi Nakayama Date: Sat, 20 Aug 2016 15:12:33 +0900 Message-ID: Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Dmitry Gutov Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > Maybe the fix could be in json-pretty-print. I agree that json-pretty-print should be responsible to the issue. But I think (let ((json-null 'NULL)) (json-encode (json-read-from-string "{}"))) is also a bug. How about the following patch? >From 24a11fc81ea283c7f999bbcf87ea0f2c01c1c24e Mon Sep 17 00:00:00 2001 From: Yoichi Nakayama Date: Sat, 20 Aug 2016 15:00:28 +0900 Subject: [PATCH] Distinguish empty json object and null * lisp/json.el (json-encode-list, json-encode): Handle empty object correctly when json-null is not nil. (json-pretty-print): Bind json-null to distinguish empty object and null. --- lisp/json.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index fdac8d9..a439f77 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -588,7 +588,7 @@ Please see the documentation of `json-object-type' and `json-key-type'." "Return a JSON representation of LIST. Tries to DWIM: simple lists become JSON arrays, while alists and plists become JSON objects." - (cond ((null list) "null") + (cond ((eq json-null list) "null") ((json-alist-p list) (json-encode-alist list)) ((json-plist-p list) (json-encode-plist list)) ((listp list) (json-encode-array list)) @@ -700,12 +700,12 @@ Advances point just past JSON object." ((stringp object) (json-encode-string object)) ((keywordp object) (json-encode-string (substring (symbol-name object) 1))) - ((symbolp object) (json-encode-string - (symbol-name object))) ((numberp object) (json-encode-number object)) ((arrayp object) (json-encode-array object)) ((hash-table-p object) (json-encode-hash-table object)) ((listp object) (json-encode-list object)) + ((symbolp object) (json-encode-string + (symbol-name object))) (t (signal 'json-error (list object))))) ;; Pretty printing @@ -722,6 +722,8 @@ Advances point just past JSON object." (let ((json-encoding-pretty-print t) ;; Ensure that ordering is maintained (json-object-type 'alist) + ;; Distinguish empty object and null + (json-null :json-null) (txt (delete-and-extract-region begin end))) (insert (json-encode (json-read-from-string txt)))))) -- 2.8.1 From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 20 21:30:32 2016 Received: (at 24252) by debbugs.gnu.org; 21 Aug 2016 01:30:32 +0000 Received: from localhost ([127.0.0.1]:35440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbHaq-0006Ni-Ik for submit@debbugs.gnu.org; Sat, 20 Aug 2016 21:30:32 -0400 Received: from mail-it0-f44.google.com ([209.85.214.44]:36853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbHap-0006NT-5I for 24252@debbugs.gnu.org; Sat, 20 Aug 2016 21:30:31 -0400 Received: by mail-it0-f44.google.com with SMTP id e63so60564105ith.1 for <24252@debbugs.gnu.org>; Sat, 20 Aug 2016 18:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ztlNH3MoNrY9M1wdX6vnR2PTIkH2zNicbT/3ITMf/VM=; b=FBGB5pJfLu2HflynJgWzJVpn9P4GNUFBYWDJkR8ORFfKYZgkvO6bQj77fIXbmhMBhi ZLu8tyz1eQ7YtN3wYdREbDC2xzSYOW6dQ4nNXGxs62iX+rUhx1UHF6JAntNwqhwJJ1Xs rf+SKBMPmoRxspgKtryTCy3o44INJ1fh1VFdfVVnse8D5uCEf++Ey3krTDyp9iKNIw65 DYxJncrCA05/9S4mb44KGYcIjo1vSHHCkbX1yN5ZqLJO4m9L1ql4FO6L4B+lnMO3377K n1uyMUVmjNzUUtE4bEamaRBhwFYpb++l9KkQGI/sYWWuOoB7iRGNWaBut/cXLhwmmBef WYsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ztlNH3MoNrY9M1wdX6vnR2PTIkH2zNicbT/3ITMf/VM=; b=Xx0Y2TsNJkljH8Z8pTQUmdbPlLvTmZooQR7GMyoywhoP8dM0itOzPOKv7ZZtaZPB/a NK38k062V6sCDWTgLF8cJBUhMGBi2+ixLrgScWbN6ghaIPVi3y10+BqvQ/iMPI5xnigq +7eIxISHqAXBkTD7MsSnD/wqK71S0V5hwHYChBG9B4wfX0RNTjmGpAaAfrRkmuZhzQyg JBJmzXFDc6dKfuIhu9V8Pg24grzh3/VBjFaM6Sln49QDV6GCY35ZT79ISZvAQ/42AfgN 5AsN9v5ax1ZjxP0Dt/UfE5E02FFEi116buOWiHSVO6O0I4zkgo0vebYxZDHZ4hHltQvC kXgw== X-Gm-Message-State: AEkoousyemkQHiyn7DE+6PcHyL7Kz2Nf/BDI5wSJCUGUssHpRnE6+wgxwuom9Vms9RGLyxp/5OlL0a/UTNaztA== X-Received: by 10.36.107.82 with SMTP id v79mr13548324itc.52.1471743025589; Sat, 20 Aug 2016 18:30:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.3.18 with HTTP; Sat, 20 Aug 2016 18:30:25 -0700 (PDT) In-Reply-To: References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> From: Yoichi Nakayama Date: Sun, 21 Aug 2016 10:30:25 +0900 Message-ID: Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Dmitry Gutov Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) The second patch dosn't work with some cases. Applying json-pretty-print to {":json-null": 1} cause error "Bad JSON object key: :json-null". On Sat, Aug 20, 2016 at 3:12 PM, Yoichi Nakayama wrote: >> Maybe the fix could be in json-pretty-print. > > I agree that json-pretty-print should be responsible to the issue. > But I think > > (let ((json-null 'NULL)) (json-encode (json-read-from-string "{}"))) > > is also a bug. > How about the following patch? > > From 24a11fc81ea283c7f999bbcf87ea0f2c01c1c24e Mon Sep 17 00:00:00 2001 > From: Yoichi Nakayama > Date: Sat, 20 Aug 2016 15:00:28 +0900 > Subject: [PATCH] Distinguish empty json object and null > > * lisp/json.el (json-encode-list, json-encode): Handle empty object > correctly when json-null is not nil. > (json-pretty-print): Bind json-null to distinguish empty object and null. > --- > lisp/json.el | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/lisp/json.el b/lisp/json.el > index fdac8d9..a439f77 100644 > --- a/lisp/json.el > +++ b/lisp/json.el > @@ -588,7 +588,7 @@ Please see the documentation of `json-object-type' > and `json-key-type'." > "Return a JSON representation of LIST. > Tries to DWIM: simple lists become JSON arrays, while alists and plists > become JSON objects." > - (cond ((null list) "null") > + (cond ((eq json-null list) "null") > ((json-alist-p list) (json-encode-alist list)) > ((json-plist-p list) (json-encode-plist list)) > ((listp list) (json-encode-array list)) > @@ -700,12 +700,12 @@ Advances point just past JSON object." > ((stringp object) (json-encode-string object)) > ((keywordp object) (json-encode-string > (substring (symbol-name object) 1))) > - ((symbolp object) (json-encode-string > - (symbol-name object))) > ((numberp object) (json-encode-number object)) > ((arrayp object) (json-encode-array object)) > ((hash-table-p object) (json-encode-hash-table object)) > ((listp object) (json-encode-list object)) > + ((symbolp object) (json-encode-string > + (symbol-name object))) > (t (signal 'json-error (list object))))) > > ;; Pretty printing > @@ -722,6 +722,8 @@ Advances point just past JSON object." > (let ((json-encoding-pretty-print t) > ;; Ensure that ordering is maintained > (json-object-type 'alist) > + ;; Distinguish empty object and null > + (json-null :json-null) > (txt (delete-and-extract-region begin end))) > (insert (json-encode (json-read-from-string txt)))))) > > -- > 2.8.1 -- Yoichi NAKAYAMA From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 20 23:42:36 2016 Received: (at 24252) by debbugs.gnu.org; 21 Aug 2016 03:42:36 +0000 Received: from localhost ([127.0.0.1]:35459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbJee-0002eP-BW for submit@debbugs.gnu.org; Sat, 20 Aug 2016 23:42:36 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:34718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbJec-0002e9-MY for 24252@debbugs.gnu.org; Sat, 20 Aug 2016 23:42:35 -0400 Received: by mail-lf0-f42.google.com with SMTP id l89so56623241lfi.1 for <24252@debbugs.gnu.org>; Sat, 20 Aug 2016 20:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=xMn5LqHjxCONdqufVQzF/lpShCXX9OSRC67TvaWvYME=; b=Yi1Ru4qU+Hc/Gz9PZ6V37vFpOpjjsEbv4/FzLnOUv6yCI0cMMK6X8ryvvDAYYBB05Y jq5DQZmxGqvx+TegHN+j7ro210PWJbCiZ8gKVji8Yj14qnuu6qR+nS53SbE0FWz9khh/ 9o7idWHiG+wPv2mHOXuYF99KSVLJ92N9wY0PByMHeqWn/5wEzSCX1x676v85VRcs1aby D+lVz35fxbtTHoEKQMC5Ye+h6C0o/8XNDLI3XAdQlh4hMZz11H7kdllRE0ZEwypRf9+8 KQNKTsxTLQFHJXuNSKJmXWfLiOT1ug4iLaPG9eLqlo3w+LsyjXWlCoWeqPuhdGjOGSvv PiQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=xMn5LqHjxCONdqufVQzF/lpShCXX9OSRC67TvaWvYME=; b=g7wFCKOwW8ohVOLs3c2uvEKwqYV4JOWhiUtQUqmd9SL1hSeVPwprRai1eCjsRzGZSo 419TyZl74tqdhIJxGUPTRJo/Mu/SqGCXPEJIbRFMC9v+lHL50Ca50GFjWQlKoWxM+7NG jduJ+tnAW08tht9Uq90JG3VM/dvNP1F8T9Vlk+GQXTqsQKXr8jWWr7ihc5bXYx/8Z551 r2A3+NNr3koSFP9JeSBM0B96p1qw0OcLTze2N9DUoyV0AHUGCmmMW4I/Ml8cYNIwQRmf mEHkKWxS3m1aR9gS45h2Db3G62WDh50YpgJKI1xM6ZovDg74P6uYIqHGjGM51TQw4NBU +OXw== X-Gm-Message-State: AEkooutOkT+PiHJVHXprpp/ZDNZ8PeLV/e/Ra/C78xFxkDKyvHzuA70dERpPS92eVlPBdg== X-Received: by 10.46.1.162 with SMTP id f34mr3569774lji.22.1471750948591; Sat, 20 Aug 2016 20:42:28 -0700 (PDT) Received: from [192.168.1.190] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id 196sm2614824ljf.5.2016.08.20.20.42.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Aug 2016 20:42:27 -0700 (PDT) Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Yoichi Nakayama References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> From: Dmitry Gutov Message-ID: <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> Date: Sun, 21 Aug 2016 06:42:26 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) On 08/20/2016 09:12 AM, Yoichi Nakayama wrote: > I agree that json-pretty-print should be responsible to the issue. > But I think > > (let ((json-null 'NULL)) (json-encode (json-read-from-string "{}"))) > > is also a bug. > How about the following patch? Something like this looks like a good idea to me. Especially if you figure out what's the problem you have "with some cases". From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 21 08:11:24 2016 Received: (at 24252) by debbugs.gnu.org; 21 Aug 2016 12:11:24 +0000 Received: from localhost ([127.0.0.1]:35551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbRb2-0003Ed-6k for submit@debbugs.gnu.org; Sun, 21 Aug 2016 08:11:24 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:35384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbRb0-0003EO-Mh for 24252@debbugs.gnu.org; Sun, 21 Aug 2016 08:11:22 -0400 Received: by mail-it0-f42.google.com with SMTP id x131so66460385ite.0 for <24252@debbugs.gnu.org>; Sun, 21 Aug 2016 05:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yPW95dhXCZEu8LBahXrnkIhHI7+YzZvZsZFJoP7p2tg=; b=ZqaEYfP7HCZ6iEZqPQDnQ1w6FABqmo5IU6uNQcdahxyXlXvNqiC6Km+7g3dn6Eb+VL UgLbe/9cFqkVKqiaW5J0e4rgnABzhB/E2JErFt2BQCCm0CCCD+yjm+iyeGrJSlmkUHit Y5FXRZ7Ig2N13ia0uD03hk/1TgGeTO2g8hqm2lcOOiY95PV+DKnkNPO+gHXAwMBNtqYs NrvEUqhSf/CzItR4CPin2QcfaC0/XlYjV2v5Fwdo4TTnqFz7PP5UgeaBNELIFjiep3Jc oJbcHEB3DU918FhjuGljNl0SmCEcKkH1cVX3TjoEH3lSJMvMXHB+JM7liNfw2xPHXQOL 7X/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yPW95dhXCZEu8LBahXrnkIhHI7+YzZvZsZFJoP7p2tg=; b=NENcxJTRqD3L9LRtt94DX8SXYEmuacToeW6fMy4nUnL2VuXAqxab+zjWrosmCYp93J 3RILkPL5Lgw6ieRH4oNbbA9jzf57gy85zuE+y+PEbz60VB84T1MjG/4QHCZsQtdE/VAM 2kceRJcJz7AZyRpqZJxOVZj4JK+6VMhg+cSjvkaAc6soMl+MY+xte3nQ3JHfvQTAtzma Usysp6hoH59YlsRo7SqKGbeIpauqlL4QtcFoF3lWi5QIkeWWkhTLhw1YUKmhnI1coTAC wd+w1EeLfFy0CjiXugL3KFD4Ww/zifvFlWM4GcS0YEz00+4r5qjQPYoHufMuCb79YUE1 CFtw== X-Gm-Message-State: AEkoouv38p8fRohAWfKMFh5hoFLLJxZM2oSDu7GTMdEClenOZhMKPyqE704Pyk6XhEAjvQ0gUzDT2IRQcdFf9Q== X-Received: by 10.36.254.72 with SMTP id w69mr15010428ith.52.1471781477189; Sun, 21 Aug 2016 05:11:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.3.18 with HTTP; Sun, 21 Aug 2016 05:11:16 -0700 (PDT) In-Reply-To: <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> From: Yoichi Nakayama Date: Sun, 21 Aug 2016 21:11:16 +0900 Message-ID: Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Dmitry Gutov Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) There was another potential bug that json-encode-key wrongly interpret symbols internally used in json.el. The problem is not caused by my previous patch, but the patch introduces another internal symbol :json-null and increase possibility to encounter it. Following patch will fix it and make it safe to apply my second patch >From 4d3ad1d3bbe6b3e47743f42427ac26cf316c12b5 Mon Sep 17 00:00:00 2001 From: Yoichi Nakayama Date: Sun, 21 Aug 2016 20:24:03 +0900 Subject: [PATCH] Make json-encode-key not to signal with valid keys Despite strings like ":json-false", "t", "nil" are valid object key, their elisp representation were confused with internal symbols in json-encode-key and cause json-key-format error unexpectedly. * (json-encode-key): Rewrite without using json-encode. --- lisp/json.el | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index a439f77..a387b08 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -425,14 +425,30 @@ representation will be parsed correctly." (push "\"" res) (apply #'concat "\"" (nreverse res)))) -(defun json-encode-key (object) - "Return a JSON representation of OBJECT. -If the resulting JSON object isn't a valid JSON object key, -this signals `json-key-format'." - (let ((encoded (json-encode object))) - (unless (stringp (json-read-from-string encoded)) - (signal 'json-key-format (list object))) - encoded)) +(defun json-encode-key (key) + "Return a JSON representation of object key. +If key isn't valid Elisp object as key, this signals `json-key-format'." + (let ((json-key-type + (if (eq json-key-type nil) + (cdr (assq json-object-type '((hash-table . string) + (alist . symbol) + (plist . keyword)))) + json-key-type))) + (json-encode-string + (cond ((eq json-key-type 'string) + (if (stringp key) + key + (signal 'json-key-format (list key)))) + ((eq json-key-type 'symbol) + (if (symbolp key) + (symbol-name key) + (signal 'json-key-format (list key)))) + ((eq json-key-type 'keyword) + (if (keywordp key) + (substring (symbol-name key) 1) + (signal 'json-key-format (list key)))) + (t + (signal 'json-error (list key))))))) ;;; JSON Objects -- 2.8.1 From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 21 09:33:07 2016 Received: (at 24252) by debbugs.gnu.org; 21 Aug 2016 13:33:07 +0000 Received: from localhost ([127.0.0.1]:35610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbSs7-0005Fb-EP for submit@debbugs.gnu.org; Sun, 21 Aug 2016 09:33:07 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:37373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbSs5-0005F2-Hs for 24252@debbugs.gnu.org; Sun, 21 Aug 2016 09:33:05 -0400 Received: by mail-it0-f53.google.com with SMTP id f6so61837702ith.0 for <24252@debbugs.gnu.org>; Sun, 21 Aug 2016 06:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2HJ0pJghG+zXTALUsi6DN3odZBIWPmKy8jdXwqANW9Y=; b=vLeKNtXEgE9Tm5R5nCJL9e6JFfxCvpjTX+JbIidtwpAhWZE9yDd/8yKR/En6mEmRUm ATplxKNuzNUwPfusU7UD1jNfwy0YaqDflp26bHxYe2eLnRQObbfetR3nZf52KZAHAUB2 PWQATEbakHCAwChxwN1FwwsYnYb/ZuSL2JIUBqvkC+Fi4q+XSUX+c9rQM8XZS6WLtk1l A6Cr1ZtCBzUeNjpGLrTYEnrbgH/6evR4heOO9ccPxkmcvwh6ZpLdKPxjBOzukEcJpCRr 6Ll+pSGWKkCXOXbdaUKP9jPx8r9sXw0pXk86xRWv0fQ9ggVxdqVeVKpZbT3DalmR9m1O afYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2HJ0pJghG+zXTALUsi6DN3odZBIWPmKy8jdXwqANW9Y=; b=m4DI7/lR1CUhSdpaGswBO/NJjRbejHuJXg6HkD5eHBGoTbp6jBFiK9MDT6RaeWimK7 YtMuNp7cHDYcQwEl4AP8tvsJISPZmzGe5y1Nz/4+D/9XGRmqml/o4TKO47NlbxXbBpmk VK7xAYfkSq5c9ExrQpKh99F2bl9M6WUMzxoKY607qDgqEUfmCmISQqZim9q6QNA+gBu0 GBEimNOjbKrmePWmYQ0gDEkDKpYbtqG3xMdjD2Gvy4t5w156x6op0gAe2jAjLFdWoQ5r OXcCN/lDnBvx3S1NS0roINZeMCMqZFK+BPRBm2/m3V6RQEloJH7mitkzkmUBkBfgq2bn NqmA== X-Gm-Message-State: AEkoouvOrOO1XhWYzgtpq1QLHYmQ3ciY/X1EkhGEco01aZaO7JDlMkv7eRAbPckbgAQwZ1eS3gJngQBb33AQ4g== X-Received: by 10.36.189.143 with SMTP id x137mr16093462ite.18.1471786380022; Sun, 21 Aug 2016 06:33:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.3.18 with HTTP; Sun, 21 Aug 2016 06:32:59 -0700 (PDT) In-Reply-To: References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> From: Yoichi Nakayama Date: Sun, 21 Aug 2016 22:32:59 +0900 Message-ID: Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Dmitry Gutov Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) The change in json-encode-key broke tests in json-tests.el. I'll investigate it. Ran 34 tests, 28 results as expected, 6 unexpected (2016-08-21 22:30:23+0900) 6 unexpected results: FAILED test-json-encode-alist-with-sort-predicate FAILED test-json-encode-hash-table FAILED test-json-encode-key FAILED test-json-encode-list FAILED test-json-encode-plist FAILED test-json-encode-plist-with-sort-predicate -- Yoichi NAKAYAMA From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 21 11:06:21 2016 Received: (at 24252) by debbugs.gnu.org; 21 Aug 2016 15:06:21 +0000 Received: from localhost ([127.0.0.1]:35938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbUKL-0007ZK-2k for submit@debbugs.gnu.org; Sun, 21 Aug 2016 11:06:21 -0400 Received: from mail-it0-f48.google.com ([209.85.214.48]:36409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbUKI-0007Z6-9F for 24252@debbugs.gnu.org; Sun, 21 Aug 2016 11:06:19 -0400 Received: by mail-it0-f48.google.com with SMTP id e63so68633486ith.1 for <24252@debbugs.gnu.org>; Sun, 21 Aug 2016 08:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W/zTK3On4E8qX7Z5zWLmdjqdQ5ogoCVRMgHyac2UoXQ=; b=JFyFFd5gHH2YIC3YujytE5rhqvKTeOmKwoD9NO/DnnFgzwoQ1tfWi42ZntECYNwvcD hxyOeSrujd9fYFD8TEKPn5TJkl2eA/py4HxVjSC90r9QqlCR6DsGKOtvM8aC65Bx0g5y Svf45T3Iwj1R09zaIr8PXqT0jz3rHJ/V71gY/8SxTXnRrHeupzpLjDAvOa6U4LzjPa2Q gvNENdo8Yl0dGEfknT3BHtVzXqIdQ+hTvJg87rOWBJAlbB45r8KvuGqCI9svuKv6r7SY aMwUZG7+DRCb0GPG53D7P+aGt5bXRBg+5M1Xo9Lb6VyK3t2kmUrJ+pwjm+TZubyMU8BD 0RPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W/zTK3On4E8qX7Z5zWLmdjqdQ5ogoCVRMgHyac2UoXQ=; b=gUgFxTUDRk5khAkspvta90rEDIUB6k+O6psQDON74j/02dUpX9X+ujUVTWLNJ8eXRS aaQVIgT4GKuZWAvhsbNy3UFM04lCXiAm1m39CEZawamV+fPgxCMMyRgKKjC+3EK+FGtv lL3vtPPJ6CfJkps1qH18/nkNH1sJrNIe29YaAI1tL0OZe+kyzsbaLdf0h7b+59vsDCir RLr1CuMNmyXv5P34ZTJDPPJqskcS8/qoVh8S3iL+fOyqQhSFktAEb9UG0xtL3IVGTuop ZIopRHkfsgE8la+mgcvtPPjyOF9WQsnZ4DZxcT6dDsdVDpLb0FZ8Py5DkFZ7AsXq/TDR JDlg== X-Gm-Message-State: AEkooutJQJduroI65j40AZJdXqIPsWu6CX4/2KX1C6rG/XbxdFN0/z6R6WR5lVCulGkV0dW2VCAx5YQBdz8lFw== X-Received: by 10.36.189.143 with SMTP id x137mr16452695ite.18.1471791972546; Sun, 21 Aug 2016 08:06:12 -0700 (PDT) MIME-Version: 1.0 References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> In-Reply-To: From: Yoichi Nakayama Date: Sun, 21 Aug 2016 15:06:02 +0000 Message-ID: Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Dmitry Gutov Content-Type: multipart/alternative; boundary=94eb2c19c026b5011d053a964594 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --94eb2c19c026b5011d053a964594 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Fixed tests and update object encoding functions to be functional without binding json-object-type as far as possible. ;; You can find a series of patches at https://github.com/yoichi/emacs/tree/fix/json-empty-object2 >From d8549a88633704fc76eb6cdafa6b6ea591fb14e3 Mon Sep 17 00:00:00 2001 From: Yoichi Nakayama Date: Sun, 21 Aug 2016 23:54:43 +0900 Subject: [PATCH] Bind json-object-type on object encoding functions If elisp object are plist or hash-table, assume they are created with associated json-object-type. * json.el (json--plist-to-alist): Convert key format. (json-encode-hash-table, json-encode-alist, json-encode-plist): Bind json-object-type. * json-tests.el (test-json-plist-to-alist): Use default key type for expected value, and add test with json-key-type. (test-json-encode-key): Add test not to confuse internal symbols. (test-json-encode-hash-table, test-json-encode-alist-with-sort-predicate, test-json-encode-list): Use default key type. --- lisp/json.el | 134 ++++++++++++++++++++++++++---------------------- test/lisp/json-tests.el | 29 +++++++---- 2 files changed, 91 insertions(+), 72 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index a387b08..24fefc5 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -174,6 +174,10 @@ Unlike `reverse', this keeps the property-value pairs intact." (while plist (let ((prop (pop plist)) (val (pop plist))) + (when (and (not json-key-type) + (keywordp prop)) + (setq prop (intern + (substring (symbol-name prop) 1)))) (push (cons prop val) res))) (nreverse res))) @@ -526,79 +530,85 @@ Please see the documentation of `json-object-type' and `json-key-type'." (defun json-encode-hash-table (hash-table) "Return a JSON representation of HASH-TABLE." - (if json-encoding-object-sort-predicate - (json-encode-alist (map-into hash-table 'list)) + (let ((json-object-type 'hash-table)) + (if json-encoding-object-sort-predicate + (let ((json-key-type + (or json-key-type + 'string))) + (json-encode-alist (map-into hash-table 'list))) + (format "{%s%s}" + (json-join + (let (r) + (json--with-indentation + (maphash + (lambda (k v) + (push (format + (if json-encoding-pretty-print + "%s%s: %s" + "%s%s:%s") + json--encoding-current-indentation + (json-encode-key k) + (json-encode v)) + r)) + hash-table)) + r) + json-encoding-separator) + (if (or (not json-encoding-pretty-print) + json-encoding-lisp-style-closings) + "" + json--encoding-current-indentation))))) + +;; List encoding (including alists and plists) + +(defun json-encode-alist (alist) + "Return a JSON representation of ALIST." + (let ((json-object-type 'alist)) + (when json-encoding-object-sort-predicate + (setq alist + (sort alist (lambda (a b) + (funcall json-encoding-object-sort-predicate + (car a) (car b)))))) (format "{%s%s}" (json-join - (let (r) - (json--with-indentation - (maphash - (lambda (k v) - (push (format - (if json-encoding-pretty-print - "%s%s: %s" - "%s%s:%s") - json--encoding-current-indentation - (json-encode-key k) - (json-encode v)) - r)) - hash-table)) - r) + (json--with-indentation + (mapcar (lambda (cons) + (format (if json-encoding-pretty-print + "%s%s: %s" + "%s%s:%s") + json--encoding-current-indentation + (json-encode-key (car cons)) + (json-encode (cdr cons)))) + alist)) json-encoding-separator) (if (or (not json-encoding-pretty-print) json-encoding-lisp-style-closings) "" json--encoding-current-indentation)))) -;; List encoding (including alists and plists) - -(defun json-encode-alist (alist) - "Return a JSON representation of ALIST." - (when json-encoding-object-sort-predicate - (setq alist - (sort alist (lambda (a b) - (funcall json-encoding-object-sort-predicate - (car a) (car b)))))) - (format "{%s%s}" - (json-join - (json--with-indentation - (mapcar (lambda (cons) - (format (if json-encoding-pretty-print - "%s%s: %s" - "%s%s:%s") - json--encoding-current-indentation - (json-encode-key (car cons)) - (json-encode (cdr cons)))) - alist)) - json-encoding-separator) - (if (or (not json-encoding-pretty-print) - json-encoding-lisp-style-closings) - "" - json--encoding-current-indentation))) - (defun json-encode-plist (plist) "Return a JSON representation of PLIST." - (if json-encoding-object-sort-predicate - (json-encode-alist (json--plist-to-alist plist)) - (let (result) - (json--with-indentation - (while plist - (push (concat - json--encoding-current-indentation - (json-encode-key (car plist)) - (if json-encoding-pretty-print - ": " - ":") - (json-encode (cadr plist))) - result) - (setq plist (cddr plist)))) - (concat "{" - (json-join (nreverse result) json-encoding-separator) - (if (and json-encoding-pretty-print - (not json-encoding-lisp-style-closings)) + (let ((json-object-type 'plist)) + (if json-encoding-object-sort-predicate + (json-encode-alist (json--plist-to-alist plist)) + (let (result) + (json--with-indentation + (while plist + (push (concat json--encoding-current-indentation - "") - "}")))) + (json-encode-key (car plist)) + (if json-encoding-pretty-print + ": " + ":") + (json-encode (cadr plist))) + result) + (setq plist (cddr plist)))) + (concat "{" + (json-join (nreverse result) json-encoding-separator) + (if (and json-encoding-pretty-print + (not json-encoding-lisp-style-closings)) + json--encoding-current-indentation + "") + "}"))))) (defun json-encode-list (list) "Return a JSON representation of LIST. diff --git a/test/lisp/json-tests.el b/test/lisp/json-tests.el index 78cebb4..d5abb58 100644 --- a/test/lisp/json-tests.el +++ b/test/lisp/json-tests.el @@ -62,9 +62,11 @@ Point is moved to beginning of the buffer." (ert-deftest test-json-plist-to-alist () (should (equal (json--plist-to-alist '()) '())) - (should (equal (json--plist-to-alist '(:a 1)) '((:a . 1)))) + (should (equal (json--plist-to-alist '(:a 1)) '((a . 1)))) + (let ((json-key-type 'keyword)) + (should (equal (json--plist-to-alist '(:a 1)) '((:a . 1))))) (should (equal (json--plist-to-alist '(:a 1 :b 2 :c 3)) - '((:a . 1) (:b . 2) (:c . 3))))) + '((a . 1) (b . 2) (c . 3))))) (ert-deftest test-json-advance () (json-tests--with-temp-buffer "{ \"a\": 1 }" @@ -177,9 +179,16 @@ Point is moved to beginning of the buffer." "\"\\nasd=D1=84=D1=8B=D0=B2\\u001f\u007ffgh\\t\""))) (ert-deftest test-json-encode-key () - (should (equal (json-encode-key "foo") "\"foo\"")) - (should (equal (json-encode-key 'foo) "\"foo\"")) - (should (equal (json-encode-key :foo) "\"foo\"")) + (let ((json-key-type 'string)) + (should (equal (json-encode-key "foo") "\"foo\"")) + (should-error (json-encode-key t) :type 'json-key-format)) + (let ((json-key-type 'symbol)) + (should (equal (json-encode-key 'foo) "\"foo\"")) + (should (equal (json-encode-key t) "\"t\"")) + (should (equal (json-encode-key :t) "\":t\""))) + (let ((json-key-type 'keyword)) + (should (equal (json-encode-key :foo) "\"foo\"")) + (should-error (json-encode-key t) :type 'json-key-format)) (should-error (json-encode-key 5) :type 'json-key-format) (should-error (json-encode-key ["foo"]) :type 'json-key-format) (should-error (json-encode-key '("foo")) :type 'json-key-format)) @@ -238,9 +247,9 @@ Point is moved to beginning of the buffer." (let ((hash-table (make-hash-table)) (json-encoding-object-sort-predicate 'string<) (json-encoding-pretty-print nil)) - (puthash :a 1 hash-table) - (puthash :b 2 hash-table) - (puthash :c 3 hash-table) + (puthash "a" 1 hash-table) + (puthash "b" 2 hash-table) + (puthash "c" 3 hash-table) (should (equal (json-encode hash-table) "{\"a\":1,\"b\":2,\"c\":3}")))) @@ -261,7 +270,7 @@ Point is moved to beginning of the buffer." (should (equal (json-encode plist) "{\"a\":1,\"b\":2,\"c\":3}")))) (ert-deftest test-json-encode-alist-with-sort-predicate () - (let ((alist '((:c . 3) (:a . 1) (:b . 2))) + (let ((alist '((c . 3) (a . 1) (b . 2))) (json-encoding-object-sort-predicate 'string<) (json-encoding-pretty-print nil)) (should (equal (json-encode alist) "{\"a\":1,\"b\":2,\"c\":3}")))) @@ -270,7 +279,7 @@ Point is moved to beginning of the buffer." (let ((json-encoding-pretty-print nil)) (should (equal (json-encode-list '(:a 1 :b 2)) "{\"a\":1,\"b\":2}")) - (should (equal (json-encode-list '((:a . 1) (:b . 2))) + (should (equal (json-encode-list '((a . 1) (b . 2))) "{\"a\":1,\"b\":2}")) (should (equal (json-encode-list '(1 2 3 4)) "[1,2,3,4]")))) --=20 2.8.1 2016=E5=B9=B48=E6=9C=8821=E6=97=A5(=E6=97=A5) 22:32 Yoichi Nakayama : > The change in json-encode-key broke tests in json-tests.el. I'll > investigate it. > > Ran 34 tests, 28 results as expected, 6 unexpected (2016-08-21 > 22:30:23+0900) > > 6 unexpected results: > FAILED test-json-encode-alist-with-sort-predicate > FAILED test-json-encode-hash-table > FAILED test-json-encode-key > FAILED test-json-encode-list > FAILED test-json-encode-plist > FAILED test-json-encode-plist-with-sort-predicate > > -- > Yoichi NAKAYAMA > --94eb2c19c026b5011d053a964594 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Fixed tests and update object encoding functions to b= e functional without
binding json-object-type as far as possible.=
;; You can find a series of patches at=C2=A0https://github.com/yoic= hi/emacs/tree/fix/json-empty-object2

= >From d8549a88633704fc76eb6cdafa6b6ea591fb14e3 Mon Sep 17 00:00:00 2001
From: Yoichi Nakayama <yoichi.nakayama@gmail.com>
Date: Sun, 21 Aug 2016 23:54:= 43 +0900
Subject: [PATCH] Bind json-object-type on object encodin= g functions

If elisp object are plist or hash-tabl= e, assume they are created with
associated json-object-type.

* json.el (json--plist-to-alist): Convert key format.<= /div>
(json-encode-hash-table, json-encode-alist, json-encode-plist): B= ind
json-object-type.
* json-tests.el (test-json-plist-= to-alist): Use default key type for
expected value, and add test = with json-key-type.
(test-json-encode-key): Add test not to confu= se internal symbols.
(test-json-encode-hash-table, test-json-enco= de-alist-with-sort-predicate,
test-json-encode-list): Use default= key type.
---
=C2=A0lisp/json.el =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0| 134 ++++++++++++++++++++++++++----------------------<= /div>
=C2=A0test/lisp/json-tests.el | =C2=A029 +++++++----
= =C2=A02 files changed, 91 insertions(+), 72 deletions(-)

diff --git a/lisp/json.el b/lisp/json.el
index a387b08..24= fefc5 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -174,6 +174,10 @@ Unlike `reverse', this keeps the property-va= lue pairs intact."
=C2=A0 =C2=A0 =C2=A0(while plist
=C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((prop (pop plist))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(val (pop plist)))
+ =C2=A0= =C2=A0 =C2=A0 =C2=A0(when (and (not json-key-type)
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (keywordp prop))
=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq prop (intern
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(s= ubstring (symbol-name prop) 1))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(push (cons prop val) res)))
=C2=A0 =C2=A0 =C2=A0(nreverse res= )))
=C2=A0
@@ -526,79 +530,85 @@ Please see the documen= tation of `json-object-type' and `json-key-type'."
= =C2=A0
=C2=A0(defun json-encode-hash-table (hash-table)
=C2=A0 =C2=A0"Return a JSON representation of HASH-TABLE."
=
- =C2=A0(if json-encoding-object-sort-predicate
- =C2=A0 =C2= =A0 =C2=A0(json-encode-alist (map-into hash-table 'list))
+ = =C2=A0(let ((json-object-type 'hash-table))
+ =C2=A0 =C2=A0(i= f json-encoding-object-sort-predicate
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0(let ((json-key-type
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (or json-key-type
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 'string)))
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(json-encode-alist (map-into hash-table 'list)))
=
+ =C2=A0 =C2=A0 =C2=A0(format "{%s%s}"
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-join
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let (r)
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (json--with-indentation
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(maphash
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= lambda (k v)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (push (format
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if js= on-encoding-pretty-print
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&q= uot;%s%s: %s"
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s%s:%s= ")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json--encoding-current-indentatio= n
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode-key k)
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(json-encode v))
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hash= -table))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 r)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 json-en= coding-separator)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(if (or (not json-encoding-pretty-print)
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json-encoding-li= sp-style-closings)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0""
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0json--encoding-current-indentation)))))
+
+;; List encoding (including alists and plists)
+
+(defun json-encode-alist (alist)
+ =C2=A0"Return a= JSON representation of ALIST."
+ =C2=A0(let ((json-object-t= ype 'alist))
+ =C2=A0 =C2=A0(when json-encoding-object-sort-p= redicate
+ =C2=A0 =C2=A0 =C2=A0(setq alist
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(sort alist (lambda (a b)
+ =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(funcall json-encoding-object-sort-predicate
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (car a) (car b))))))
=C2= =A0 =C2=A0 =C2=A0(format "{%s%s}"
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-join
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (let (r)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (json--with-indentation
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(maphash
- =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (k v)
- =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (push (format
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(if json-encoding-pretty-print
- =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0"%s%s: %s"
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&q= uot;%s%s:%s")
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json--encoding-current-inde= ntation
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode-key k)
- =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(json-encode v))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r))
- =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hash-table))
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r)
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (json--with-indentation
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar (lambda (cons)
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(format (if json-encoding-pretty-print
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s%s: %s"
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s%s:%s")
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json--encoding-current-indentation
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode-key (car cons)= )
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode (cdr cons)= )))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0alist))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 json-encoding-separator)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(if (or (not json-encoding-pretty-print)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0js= on-encoding-lisp-style-closings)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0""
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json--encoding-current-indentation))))
=C2=A0
-;; List encoding (including alists and plists)
-
-(defun json-encode-alist (alist)
- =C2=A0&qu= ot;Return a JSON representation of ALIST."
- =C2=A0(when jso= n-encoding-object-sort-predicate
- =C2=A0 =C2=A0(setq alist
=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(sort alist (lambda (a b)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(funcall json-encoding-object-sort-predicate
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (car a) (car b))))))
- =C2=A0(= format "{%s%s}"
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(js= on-join
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (json--with-indentat= ion
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar (lambda (c= ons)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(format (if json-encoding-pretty-print
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s%s: %s"
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s%s:%s")
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0json--encoding-current-indentation
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode-key (car cons))
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode (cdr cons))))
- =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alist))
=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 json-encoding-separator)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (or (not json-encoding-pretty-pri= nt)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0json-encoding-lisp-style-closings)
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0""
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0json--encoding-current-indentation)))
-
=C2=A0(defun json-encode-plist (plist)
=C2=A0 =C2=A0"Retur= n a JSON representation of PLIST."
- =C2=A0(if json-encoding= -object-sort-predicate
- =C2=A0 =C2=A0 =C2=A0(json-encode-alist (= json--plist-to-alist plist))
- =C2=A0 =C2=A0(let (result)
- =C2=A0 =C2=A0 =C2=A0(json--with-indentation
- =C2=A0 =C2=A0 = =C2=A0 (while plist
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 (push (concat
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json--enc= oding-current-indentation
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(json-encode-key (car plist))
- =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if json-encoding-pretty-print
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0": "
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0":")
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode (cadr plist)))
- =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 result)
- =C2=A0 =C2=A0= =C2=A0 =C2=A0 (setq plist (cddr plist))))
- =C2=A0 =C2=A0 =C2=A0= (concat "{"
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0(json-join (nreverse result) json-encoding-separator)
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (and json-encoding-pret= ty-print
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (not json-encoding-lisp-style-closings))
+ =C2=A0(let ((json-object-type 'plist))
+ =C2=A0 =C2=A0(if = json-encoding-object-sort-predicate
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0= (json-encode-alist (json--plist-to-alist plist))
+ =C2=A0 =C2=A0 = =C2=A0(let (result)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0(json--with-inde= ntation
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 (while plist
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (push (concat
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json--encoding-curre= nt-indentation
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"")
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0"}"))))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(json-encode-key (car plist))
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if json-encoding-pr= etty-print
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0": "
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0":")
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encode (ca= dr plist)))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 result)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq plist (= cddr plist))))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0(concat "{"=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-j= oin (nreverse result) json-encoding-separator)
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (and json-encoding-pretty-prin= t
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (not json-encoding-lisp-style-closings))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jso= n--encoding-current-indentation
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"")
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"}")))))
=C2=A0
=C2=A0(defun json-encode-list (list)
=C2=A0 =C2=A0"= Return a JSON representation of LIST.
diff --git a/test/lisp/json= -tests.el b/test/lisp/json-tests.el
index 78cebb4..d5abb58 100644=
--- a/test/lisp/json-tests.el
+++ b/test/lisp/json-tes= ts.el
@@ -62,9 +62,11 @@ Point is moved to beginning of the buffe= r."
=C2=A0
=C2=A0(ert-deftest test-json-plist-to-a= list ()
=C2=A0 =C2=A0(should (equal (json--plist-to-alist '()= ) '()))
- =C2=A0(should (equal (json--plist-to-alist '(:a= 1)) '((:a . 1))))
+ =C2=A0(should (equal (json--plist-to-ali= st '(:a 1)) '((a . 1))))
+ =C2=A0(let ((json-key-type = 9;keyword))
+ =C2=A0 =C2=A0(should (equal (json--plist-to-alist &= #39;(:a 1)) '((:a . 1)))))
=C2=A0 =C2=A0(should (equal (json-= -plist-to-alist '(:a 1 :b 2 :c 3))
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 '((:a . 1) (:b . 2) (:c . 3)))))
<= div>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 '((a . 1)= (b . 2) (c . 3)))))
=C2=A0
=C2=A0(ert-deftest test-jso= n-advance ()
=C2=A0 =C2=A0(json-tests--with-temp-buffer "{ \= "a\": 1 }"
@@ -177,9 +179,16 @@ Point is moved to = beginning of the buffer."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 "\"\\nasd=D1=84=D1=8B=D0=B2\\u001f\u= 007ffgh\\t\"")))
=C2=A0
=C2=A0(ert-deftest te= st-json-encode-key ()
- =C2=A0(should (equal (json-encode-key &qu= ot;foo") "\"foo\""))
- =C2=A0(should (eq= ual (json-encode-key 'foo) "\"foo\""))
- = =C2=A0(should (equal (json-encode-key :foo) "\"foo\""))=
+ =C2=A0(let ((json-key-type 'string))
+ =C2=A0 = =C2=A0(should (equal (json-encode-key "foo") "\"foo\&qu= ot;"))
+ =C2=A0 =C2=A0(should-error (json-encode-key t) :typ= e 'json-key-format))
+ =C2=A0(let ((json-key-type 'symbol= ))
+ =C2=A0 =C2=A0(should (equal (json-encode-key 'foo) "= ;\"foo\""))
+ =C2=A0 =C2=A0(should (equal (json-en= code-key t) "\"t\""))
+ =C2=A0 =C2=A0(should = (equal (json-encode-key :t) "\":t\"")))
+ =C2= =A0(let ((json-key-type 'keyword))
+ =C2=A0 =C2=A0(should (eq= ual (json-encode-key :foo) "\"foo\""))
+ =C2= =A0 =C2=A0(should-error (json-encode-key t) :type 'json-key-format))
=C2=A0 =C2=A0(should-error (json-encode-key 5) :type 'json-key-= format)
=C2=A0 =C2=A0(should-error (json-encode-key ["foo&qu= ot;]) :type 'json-key-format)
=C2=A0 =C2=A0(should-error (jso= n-encode-key '("foo")) :type 'json-key-format))
@@ -238,9 +247,9 @@ Point is moved to beginning of the buffer."
=
=C2=A0 =C2=A0(let ((hash-table (make-hash-table))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(json-encoding-object-sort-predicate 'string<= ;)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encoding-pretty-print = nil))
- =C2=A0 =C2=A0(puthash :a 1 hash-table)
- =C2=A0= =C2=A0(puthash :b 2 hash-table)
- =C2=A0 =C2=A0(puthash :c 3 has= h-table)
+ =C2=A0 =C2=A0(puthash "a" 1 hash-table)
+ =C2=A0 =C2=A0(puthash "b" 2 hash-table)
+ =C2= =A0 =C2=A0(puthash "c" 3 hash-table)
=C2=A0 =C2=A0 =C2= =A0(should (equal (json-encode hash-table)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "{\"a\":1,\= "b\":2,\"c\":3}"))))
=C2=A0
@@= -261,7 +270,7 @@ Point is moved to beginning of the buffer."
=C2=A0 =C2=A0 =C2=A0(should (equal (json-encode plist) "{\"a\&q= uot;:1,\"b\":2,\"c\":3}"))))
=C2=A0
=C2=A0(ert-deftest test-json-encode-alist-with-sort-predicate ()
- =C2=A0(let ((alist '((:c . 3) (:a . 1) (:b . 2)))
+ = =C2=A0(let ((alist '((c . 3) (a . 1) (b . 2)))
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(json-encoding-object-sort-predicate 'string<)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(json-encoding-pretty-print nil)= )
=C2=A0 =C2=A0 =C2=A0(should (equal (json-encode alist) "{\= "a\":1,\"b\":2,\"c\":3}"))))
@= @ -270,7 +279,7 @@ Point is moved to beginning of the buffer."
=C2=A0 =C2=A0(let ((json-encoding-pretty-print nil))
=C2=A0 = =C2=A0 =C2=A0(should (equal (json-encode-list '(:a 1 :b 2))
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "= ;{\"a\":1,\"b\":2}"))
- =C2=A0 =C2=A0(sh= ould (equal (json-encode-list '((:a . 1) (:b . 2)))
+ =C2=A0 = =C2=A0(should (equal (json-encode-list '((a . 1) (b . 2)))
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "= ;{\"a\":1,\"b\":2}"))
=C2=A0 =C2=A0 =C2= =A0(should (equal (json-encode-list '(1 2 3 4)) "[1,2,3,4]"))= ))
=C2=A0
--=C2=A0
2.8.1

=


= 2016=E5=B9=B48=E6=9C=8821=E6=97=A5(=E6=97=A5) 22:32 Yoichi Nakayama <yoichi.nakayama@gmail.com>= :
The change in json-encode-key bro= ke tests in json-tests.el. I'll investigate it.

Ran 34 tests, 28 results as expected, 6 unexpected (2016-08-21 22:30:23+090= 0)

6 unexpected results:
=C2=A0 =C2=A0FAILED=C2=A0 test-json-encode-alist-with-sort-predicate
=C2=A0 =C2=A0FAILED=C2=A0 test-json-encode-hash-table
=C2=A0 =C2=A0FAILED=C2=A0 test-json-encode-key
=C2=A0 =C2=A0FAILED=C2=A0 test-json-encode-list
=C2=A0 =C2=A0FAILED=C2=A0 test-json-encode-plist
=C2=A0 =C2=A0FAILED=C2=A0 test-json-encode-plist-with-sort-predicate

--
Yoichi NAKAYAMA
--94eb2c19c026b5011d053a964594-- From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 26 20:05:50 2016 Received: (at 24252) by debbugs.gnu.org; 27 Aug 2016 00:05:50 +0000 Received: from localhost ([127.0.0.1]:41763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdR8A-0001Xn-8D for submit@debbugs.gnu.org; Fri, 26 Aug 2016 20:05:50 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:35839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdR89-0001Xb-21 for 24252@debbugs.gnu.org; Fri, 26 Aug 2016 20:05:49 -0400 Received: by mail-lf0-f48.google.com with SMTP id f93so66885786lfi.2 for <24252@debbugs.gnu.org>; Fri, 26 Aug 2016 17:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=eu1TqQdDaipbpJ3w6vc9MKRkV4Obwgzvaxj4tP4uXs0=; b=wS8OB9W6lWZPg5tx5Jr4wYxDqnjjZR8bTgm7zk2pHF8a0Rxvi5oQbaFK6RUtM42NwP jd/hcXaYOwfuJo4O4373BE8dqAuPcNhxWPCm9z8+CZVx8t5PbQUUX0epBje5ZhBKQHx8 ckc+6J2UGkc+Eo163bPhOgnqChto6tDt6FBXd3rhN2AD1RAdQ63xbqLnYK8SnEuxzrrv c+zwj4bzLYCkDj3g2QUU0UiZrjqemH7u88+j20rSZ3vC/pY3EFK5St7w84yEfs70l4VH cgoS/AuQKY4CTXMQoMM8AxDnwpWvJUGxjJcgRISKb2/HVnjKGMYy+HBzT2IS9v0FjqW4 mOTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=eu1TqQdDaipbpJ3w6vc9MKRkV4Obwgzvaxj4tP4uXs0=; b=EDRhpPoIBufCswOW8dovCRCI5cnfyMI9EV8RJOQWFZKykMqe5M3yLVoU2Ojno9M9M6 uJX8FqVS9+jgSm4Qel6eR6/Y2RHqSGCOrIsQsWTLXTsKr4g9U9VzQBtiHguvjAvlBwNZ WEOCulc2XhK5RdFubq+ytZu1l6zveG+FDY89skkJgFqJlyc/1j0UkVNZx1beRb0UERWB YynK+llb9Eovg9IEmnFUCv7q1yYRe/fVy1CQOpv6YM0LTF5Z25lCjWTzkJ0srtv7zm0Q frc6qgkNmLvvB6bWTQ6vbBj3RbaqxaF84V5DqyxnClCJna26nnczDEE3IKLd9Na3DiEr DUYg== X-Gm-Message-State: AE9vXwPjzOJQZX4QFdwg1fWbBDHWRBZyRwaLbIEtStUfMdQf1snsy0WP2TaCU5gfE1Twzg== X-Received: by 10.25.22.152 with SMTP id 24mr2414333lfw.180.1472256343060; Fri, 26 Aug 2016 17:05:43 -0700 (PDT) Received: from [192.168.1.190] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id i125sm4298469lfd.29.2016.08.26.17.05.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Aug 2016 17:05:42 -0700 (PDT) Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object To: Yoichi Nakayama References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> From: Dmitry Gutov Message-ID: <809ddc8d-8cd1-387b-fec6-fec60e0bd9c9@yandex.ru> Date: Sat, 27 Aug 2016 03:05:41 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Hi Yoichi, Thanks, but the changes to tests like below seem to indicate that the code breaks backward compatibility in certain respect. I'm not sure we'll want to merge it for that reason. I'd like to know what other developers think. On 08/21/2016 06:06 PM, Yoichi Nakayama wrote: > (ert-deftest test-json-plist-to-alist () > (should (equal (json--plist-to-alist '()) '())) > - (should (equal (json--plist-to-alist '(:a 1)) '((:a . 1)))) > + (should (equal (json--plist-to-alist '(:a 1)) '((a . 1)))) > + (let ((json-key-type 'keyword)) > + (should (equal (json--plist-to-alist '(:a 1)) '((:a . 1))))) > (should (equal (json--plist-to-alist '(:a 1 :b 2 :c 3)) > - '((:a . 1) (:b . 2) (:c . 3))))) > + '((a . 1) (b . 2) (c . 3))))) > > (ert-deftest test-json-advance () > (json-tests--with-temp-buffer "{ \"a\": 1 }" > @@ -177,9 +179,16 @@ Point is moved to beginning of the buffer." > "\"\\nasdфыв\\u001f\u007ffgh\\t\""))) > > (ert-deftest test-json-encode-key () > - (should (equal (json-encode-key "foo") "\"foo\"")) > - (should (equal (json-encode-key 'foo) "\"foo\"")) > - (should (equal (json-encode-key :foo) "\"foo\"")) > + (let ((json-key-type 'string)) > + (should (equal (json-encode-key "foo") "\"foo\"")) > + (should-error (json-encode-key t) :type 'json-key-format)) > + (let ((json-key-type 'symbol)) > + (should (equal (json-encode-key 'foo) "\"foo\"")) > + (should (equal (json-encode-key t) "\"t\"")) > + (should (equal (json-encode-key :t) "\":t\""))) > + (let ((json-key-type 'keyword)) > + (should (equal (json-encode-key :foo) "\"foo\"")) > + (should-error (json-encode-key t) :type 'json-key-format)) > (should-error (json-encode-key 5) :type 'json-key-format) > (should-error (json-encode-key ["foo"]) :type 'json-key-format) > (should-error (json-encode-key '("foo")) :type 'json-key-format)) > @@ -238,9 +247,9 @@ Point is moved to beginning of the buffer." > (let ((hash-table (make-hash-table)) > (json-encoding-object-sort-predicate 'string<) > (json-encoding-pretty-print nil)) > - (puthash :a 1 hash-table) > - (puthash :b 2 hash-table) > - (puthash :c 3 hash-table) > + (puthash "a" 1 hash-table) > + (puthash "b" 2 hash-table) > + (puthash "c" 3 hash-table) > (should (equal (json-encode hash-table) > "{\"a\":1,\"b\":2,\"c\":3}")))) > > @@ -261,7 +270,7 @@ Point is moved to beginning of the buffer." > (should (equal (json-encode plist) "{\"a\":1,\"b\":2,\"c\":3}")))) > > (ert-deftest test-json-encode-alist-with-sort-predicate () > - (let ((alist '((:c . 3) (:a . 1) (:b . 2))) > + (let ((alist '((c . 3) (a . 1) (b . 2))) > (json-encoding-object-sort-predicate 'string<) > (json-encoding-pretty-print nil)) > (should (equal (json-encode alist) "{\"a\":1,\"b\":2,\"c\":3}")))) > @@ -270,7 +279,7 @@ Point is moved to beginning of the buffer." > (let ((json-encoding-pretty-print nil)) > (should (equal (json-encode-list '(:a 1 :b 2)) > "{\"a\":1,\"b\":2}")) > - (should (equal (json-encode-list '((:a . 1) (:b . 2))) > + (should (equal (json-encode-list '((a . 1) (b . 2))) > "{\"a\":1,\"b\":2}")) > (should (equal (json-encode-list '(1 2 3 4)) "[1,2,3,4]")))) From debbugs-submit-bounces@debbugs.gnu.org Thu May 17 10:39:53 2018 Received: (at 24252) by debbugs.gnu.org; 17 May 2018 14:39:53 +0000 Received: from localhost ([127.0.0.1]:38693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJK4O-0000EC-PT for submit@debbugs.gnu.org; Thu, 17 May 2018 10:39:52 -0400 Received: from mail-db5eur01on0090.outbound.protection.outlook.com ([104.47.2.90]:27472 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJK4M-0000Dx-5r for 24252@debbugs.gnu.org; Thu, 17 May 2018 10:39:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foretagsplatsen.onmicrosoft.com; s=selector1-foretagsplatsen-se; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VIVR1astzG9XnjbbTMg4Ey9+1KeU/cJX6bHf2+H5TW0=; b=eEWb9R6G4RvMk9Sis8zsJ2wUjtfgIABEz+kvWmi6HtZmCghWuY8YnEnzop4DiJK2tCYALdeGBbBda6dtQ+LlwrU+6qaRb+kRp3HpC8rqcNNjWoXw+3IkFx/Wl9O/vdX6gIpvxtYjCxVF49fnnZH0OpXsMaYiuUP8Py+rjDsbNeM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=damien.cassou@foretagsplatsen.se; Received: from luz4 (109.190.44.20) by HE1PR0402MB3435.eurprd04.prod.outlook.com (2603:10a6:7:82::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Thu, 17 May 2018 14:39:40 +0000 From: Damien Cassou To: Yoichi Nakayama Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> Date: Thu, 17 May 2018 16:39:36 +0200 In-Reply-To: (Yoichi Nakayama's message of "Sun, 21 Aug 2016 15:06:02 +0000") Message-ID: <87o9he4a8n.fsf@foretagsplatsen.se> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [109.190.44.20] X-ClientProxiedBy: AM5PR06CA0010.eurprd06.prod.outlook.com (2603:10a6:206:2::23) To HE1PR0402MB3435.eurprd04.prod.outlook.com (2603:10a6:7:82::24) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(7021125)(5600026)(4534165)(7022125)(4603075)(7168020)(4627221)(201702281549075)(7048125)(7026125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020); SRVR:HE1PR0402MB3435; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB3435; 3:Hh8+ZdY3R1hsXvRAxRWdL49nG/jXPV4LtF+yYFphzI08d+Qfyl1tyHRsXcGGOTqaCau1JTJWfYve4PuiAAjwXFvqtB/phHQBOMnah4TyXW6qbRlErTAnqNsTdrVT88NM2vnB+CIZ5aamlvpPAkiDBuh+XTZzWwhWOP/CUQQd0e7zatLEEOjlOgfDfzL0eFfgcMleeqKDAXeYkZb10VygKaMqPULlak9pF6MZwmAZnWTppdhTPWnqWS0Pen6emqYp; 25:MLdE/p6Jcm5wgtrvIfE+eEmXxRH7nINo/0DhSeVCldG1QQDpkhC4w2pzlcmWjqW+bVvpyeFGIWnoPYg53UwDiZabsqPQzYsrBv55LoIO4bXJC5WKaL0WWLx+qrNUqM9HMuizIyrO8Nz1vtf5MZO/5lzTp3RLYJVXYMGy9bNQWe4TZjERswDpphh5PAJIGoSOfeqQ6M9Edyv1s1w+BaG+vKxtdTRPMqi7J1h72i82UD1GzvZj5X6pV2QCb5Jz0hXi8dnqA/yjLXDyfZ2GY+OWh9zlSNVF0dx+nV2JWxu2En04X69JO0gpKHWNVEAuPTxaFuuq58rR+Jd+cZzOddYC4g==; 31:T7POMttGHLpcTcuSpNOUs1i1YU1G/HfO1V4bXt6ILtFh1VJvaLzG+8EPXSR8nB3tdUe/VaPXU1nUhCapgBkREce0xp734afocY3S4l1XFMsVx0LmXY0i+nV8JBZE86inh9p0yLx9g+i+GYpbLdgaeS2x1kY9RDCViN3QWvoSo6kgmZPobgDJEJxEYBAr9F62JS+8d8qki0+MIy+iGh2fpeOrnUyA2kx67ajQcWeAcrQ= X-MS-TrafficTypeDiagnostic: HE1PR0402MB3435: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(6043046)(201708071742011)(7699016); SRVR:HE1PR0402MB3435; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0402MB3435; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB3435; 4:xPTT98MlnkaxrfvuN3bGArCm252VP1Dws2bOFPUMSYOWWYsjrLNMl6TtjcJflZ/u8HRvnNngzygWIc6Ts75PUMTlp7nNkTqD1FcwgEaQq+9ePN7tPjfTCUikXWa+G9mVibar43oumJ4hmu0XLiQHDyo8luFVRgwVTYMNZ2IMlRBPyxDFoXjE+wrhxJ26z7Jv2q52yYsty3h2uw9fpZeuyt5Qg3KjrgknlkuCQF0g2Dw/ipPtvacNT0lud4mLNP9qu0kWPX6MG2siElEkPZ1Ns9QRRAOzk3xCmICp1cHqF6WqMjcQRGDUySbOoBMcbI/P X-Forefront-PRVS: 067553F396 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(7966004)(346002)(396003)(39830400003)(366004)(376002)(39380400002)(199004)(189003)(52116002)(106356001)(26005)(186003)(76176011)(16526019)(81166006)(81156014)(8676002)(6116002)(55236004)(25786009)(486006)(2616005)(15974865002)(956004)(386003)(11346002)(446003)(8746002)(8936002)(476003)(59450400001)(3846002)(316002)(58126008)(2486003)(44832011)(2906002)(93886005)(50466002)(6496006)(86362001)(508600001)(105586002)(23676004)(68736007)(52146003)(53936002)(6486002)(7736002)(5660300001)(97736004)(6246003)(6916009)(6666003)(47776003)(36756003)(229853002)(4326008)(74482002)(305945005)(39060400002)(66066001)(18886075002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0402MB3435; H:luz4; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:3; Received-SPF: None (protection.outlook.com: foretagsplatsen.se does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA0MDJNQjM0MzU7MjM6SXNkQWNtWHU5Wmdvcitiem8wUUNBV1Yw?= =?utf-8?B?UVJFL21KNENZcms4d1hoczAvU0E0RHVlZUJSZ1k2TC9KNFJwbkRkbFNranM3?= =?utf-8?B?NFdJUkI2Q05QeHRHYjgrZ0pJNGZFNmFqWHhhdXlvWlNOSzRPZnZPa2lUdGJv?= =?utf-8?B?SzkwWW52V3g4S1ViaDduUEhyajV5cHpPRGJyRXNVVlFaeUtzYVpzOVpRbTAr?= =?utf-8?B?Y1hWeHlTL0ZKWlNGc29zcjFXeE1pYmZvSERWaE8zWmU1VVZFWWFycThUR0hM?= =?utf-8?B?dWxJTEZ0MVU1YURUZlV3UTZrVGxLZkVFRHM1dE4vamVBS1ZYZndSaHQ4clMy?= =?utf-8?B?cEZCam1vdlRIdkRTZisyL25GQytCOE02VnlnaGM5ZXpOOE01anJiazBWamJP?= =?utf-8?B?QU5hb3E2WnBVMjg1eW05ZEFwU05WWDR0cjQ0K21UazUrRGQrY05WTWRISDR4?= =?utf-8?B?Q3FuYkx2YUpKVXZtWXRuQjFjZTl2QUgyZGhNenZicGtQSUs1d0RyK0NzMTJs?= =?utf-8?B?aEdjaTZzUGtpSFM0NHNZcGJJcHNsRGRtT0JIb0lyd3B1cFFMKzVwMUdoRGlU?= =?utf-8?B?RjlPMHhiSU16QTd4T3U4cEFrMW82Q1VJSFVsZlpsU1Foc1JoQU1sM0xMRUhw?= =?utf-8?B?c2NPKzMzNllWejBIL0k2dDB3WVIxbzU1bVlUZnpWQ2dPMURqK2I0bDFSWUlC?= =?utf-8?B?OHlidld2VzdlYWZGTVRJZ0ZDT3A3c056V0FLNHhDWkwzaytSOVFaaGthdHR0?= =?utf-8?B?bkljTXNibGt2VzJJUDBobjBib2lBK3ExQWtYS1ZoNEx5SUh6RHhxQy9jY2hO?= =?utf-8?B?VWFkU0JqYlB0b1VUT1VacThFZG82RUp4Z1E2am4xKzFKL0Y2SlAzT2hYbXlN?= =?utf-8?B?L0IwODdJWlFuKzRqV2Q0MG90elFaSEVvaFg1QlBaOUk4bGRkR3BrM3Y3VnN0?= =?utf-8?B?bXFSeDhxenMzZWk4cDkxRGlXcHhXTWVXM2Jidy9HRm9LQk4rL2R2NU9qdXNG?= =?utf-8?B?NTBwZ0xPSmo3cDN1SlVLRVAzUEVBc0VsbjJCQzFvYzMrb2hDeElKVHg0Ymtr?= =?utf-8?B?UW10eFVUTmw0Zy8rdDlLb1FwY0xFT3ExMEpVaG4yb2srd05hTTFIRmxGSmNO?= =?utf-8?B?Sk5FZWhtRkVEZThXVXB3MWJYOFFzNjgxSVdlWGM2V3o2Q09CQ0MvL1Vxem9n?= =?utf-8?B?bjFYQkxVaHF6RmU1QTVkaHk1bzV1bXFrK2tOSEJIME9CZU4rS2ZuMFAySXVC?= =?utf-8?B?aXZVMlFiZU9kdVBMb0w3ZG9zbnp3YU11QjVBc0E5aTZEeTkxMmc1VWtJN1NB?= =?utf-8?B?bUhSVGdxS0tXTzB3dUJCV1VUbDB0cTgrWThiUEk1dENLZ2dKYnhCaWNoelFU?= =?utf-8?B?SmNSTnRxR3pieENPa1QwQ1YwU1ovZ2RLVGpxR3JaenNQMXlsd2NneXhmTkZQ?= =?utf-8?B?M0E4OEpOMk1NWnBTZzdjOHRmc1lzbWZCY2NNK2YvNy9aTm1OYWR1SzMyMmg0?= =?utf-8?B?bmtQeEw4Vi81Zm1DV0p4Mi8zVTVLTDdKSnVqbnlPSk83S1V6Ylk5V1QxMjFn?= =?utf-8?B?QzdDQ0VXTTFMT2tHMUFPaHdDdlpUbjlnQTkzMjhTWlFoOElnY2ZLcENLM0RE?= =?utf-8?B?Z3RjOFJuUmRud2RxTks3MGVMdmdzTCtzbVNlN21nbzh4cHZxTHNGSXR5dXh6?= =?utf-8?B?OTNnZTZGOWhhMmRpcDg3WGRHRWFMcWwwbnBEK0t3SFJWVnFVMnRjSitWOUxL?= =?utf-8?B?K09jT0h2ZHUvNFEyb1BMRUpHVXhqYmE1NVdnWlRuN1h2TnkrTkFpUU8wVUFj?= =?utf-8?B?bkRhL3pSODc1Ry9LMXhPeTdPOHVSVlZiUUdYdzcxZ0xMbWdQank1MVJ6UTg3?= =?utf-8?B?VklETWNMZWRVSDFRMHlrMjBlNVJuZkNoeHBUNHBmSG0vNjgvOFdERGwyM240?= =?utf-8?B?UFl0ZG5iNFNxeUE9PQ==?= X-Microsoft-Antispam-Message-Info: 6W3en4OhgMzIHdemJjP0MSNgd6VMFPKcjxWXrnrhwfSzVlYBKAZp8uNmCg78TPIGgqYgR/AWm/rpvxCmuhxIhkP7CxkGYNTAWOQ4aQcBq9hR97JjDxh1EA5Vv+BS1UTMGYfqt4Pw0SiW7MfEr11VHn6gsQFiankXscSUqlsYmhUMx+T3SQmok7ivqikUDuuH X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB3435; 6:2PiPpUNteEq1iH2BSIuwsnesdVLTTLWOQuOKLimQD4EvrkWbtNe4CL53l6AN3BaoDRqwujvJa3zVX3Yd+38zlHzH3Xu+bjbjLX7Mseu1KqaQgez2z7KhrTszf7c9SrXpLQbmiIl+5znmnOrG+fQ3uaPj8oM6Be+QnnW6+bZ4Jnqk8uHtu0stNROJv8DMvEt9w0dNKVLAn6daE22XfkIVKn2p6Y1vtO5D+pvWMyAL18RHfudqukC2JoUS3wpxSFXwe57WbvwqGv+c6250M2S3YZiIHtPj7Ra3Xmi/Z42ZZlfASda9VBXQ+ysoHJJePhAqbkfDTWQg+5VRE7PfMq1Ps0lovBO3R3qImLeCKfHToxfP5ASkb90B7IjiJvGHfxaZLFgm8BhHdDEc6bntMRe82PPjkjSaOHBvg/FL1SzRlnRt7aD2OcbTwqV8J+QNXLm3QO7UQmsMD/n82aOXENyi4g==; 5:7RVsBSc8cbbEZ/v3v70DxV8dIqcFhMovrVPJVFWx/qB9Elx5eL3rgxns/ZlMBRwlV/NWKZKbI5Wi68+gCxYol3j6RFbnk8SZsZjjijFH5WOd7daKf8vSDL5GvPAPa4y1WKULn7fSxAwn/XJpcj+wFPpdRpDTnGprd+iPB/t8mjc=; 24:4FbnTr7Yg/KhEE67eKuX8wKQA2aOIyGuh5gnP81AqArk8PT6wH0/rQKOzx4gwcKBGczlILoLMgW4LqBWPQwiogerlCzGx3wXW4kyS1tooB4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB3435; 7:fCeSozDRW92EhQp3o8lN5OopVCgw70OnG5ohpV+pMk4k4ALDIfOGm96J0W+7C01u9H+OVE8mvmzx3ymvkmA+wz/gWVKHUH3WTekqsUoDCgEUqXpp/mNeMVaODgXZVHEukIg9mf9f67bowEahLSq8/MlKFAAI2K4L/00fPcKeNwZpyphFz6BqYkbDCkcEhs4FCEVhrVqatX7nTnIcOEVOehtVyvCQnvWontpdjd5cv/iUvjsl4KCsQ1muaIsL9Fg/ X-MS-Office365-Filtering-Correlation-Id: b8644340-95bd-4fcb-5bab-08d5bc040657 X-OriginatorOrg: foretagsplatsen.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2018 14:39:40.6478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8644340-95bd-4fcb-5bab-08d5bc040657 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6a4cae39-fb28-4bd5-8fb2-64bf04843093 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0402MB3435 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24252 Cc: 24252@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yoichi Nakayama writes: > Fixed tests and update object encoding functions to be functional without > binding json-object-type as far as possible. this bug is annoying me as well while implementing a CouchDB client. --=20 Damien Cassou F=C3=B6retagsplatsen AB Phone/Fax: +46 (0)8 774 63 00 Mobile: +33 (0)6 80 50 18 91 Address: Skeppsbron 26, 4tr, SE-111 30 Stockholm Web: www.foretagsplatsen.se From debbugs-submit-bounces@debbugs.gnu.org Sat May 19 02:52:53 2018 Received: (at 24252) by debbugs.gnu.org; 19 May 2018 06:52:53 +0000 Received: from localhost ([127.0.0.1]:40398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJvjZ-0002rR-6Y for submit@debbugs.gnu.org; Sat, 19 May 2018 02:52:53 -0400 Received: from mail.choca.pics ([62.210.108.126]:46916) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJvjW-0002rJ-V9 for 24252@debbugs.gnu.org; Sat, 19 May 2018 02:52:51 -0400 Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id C673823249C8; Sat, 19 May 2018 08:52:49 +0200 (CEST) Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id u4V_LqhWPqML; Sat, 19 May 2018 08:52:48 +0200 (CEST) Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id EAF3A2324A0B; Sat, 19 May 2018 08:52:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.choca.pics EAF3A2324A0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cassou.me; s=9EA44F5C-DEF4-11E6-A83F-A08DF322D8FB; t=1526712768; bh=dR+EsyknZLC0W3lEs5aos/ohW7bgHTn74GMWpwf5XeQ=; h=From:To:Date:Message-ID:MIME-Version; b=YI+/Th8NWGvGUt6J+mrbT5/recxchWFCikWqrQHx48ng4WKrDee32uBi2/FnL8okZ KxU5AVCA1LbNhDIeD9FVYtATC7zrwzAbWujxknx2q2sv1IseguLmX6yBQo1mVmmpsR ngGxPBpkH1iUXcIBK/YmBzf8aQRTcCapQ8krHPWnML6jnHwN7eUdni6HEp/0BhhEAg XI2nUwuWwPy03a0uw8gdH1WomjblBwvxVVOiiiN5nyWvHUkbVwI3N35eWwEg9vQ9NS maQ8O5p3lksKcpLY8nj8SUOSq7EiFOLCn1yIhXXKYG7mA0UYT6vOy7+CeYgqRwDorY UAWDCXMBmzcmw== X-Virus-Scanned: amavisd-new at choca.pics Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id VwCMfOu20jd1; Sat, 19 May 2018 08:52:47 +0200 (CEST) Received: from luz4 (114.98.92.92.rev.sfr.net [92.92.98.114]) by mail.choca.pics (Postfix) with ESMTPSA id 62E8C23249C8; Sat, 19 May 2018 08:52:47 +0200 (CEST) From: Damien Cassou To: Yoichi Nakayama Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object References: Date: Sat, 19 May 2018 08:52:42 +0200 In-Reply-To: (Yoichi Nakayama's message of "Wed, 17 Aug 2016 23:54:02 +0900") Message-ID: <87o9hci1c5.fsf@cassou.me> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24252 Cc: Philipp Stephani , Mark Oteiza , Theresa O'Connor , 24252@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Yoichi Nakayama writes: > When json-pretty-print applied to "{}", it is > unexpectedly converted to "null". > This is caused by internal representations of null > and empty object are the same: > (json-read-from-string "{}") ; => nil > (json-read-from-string "null") ; => nil please find a patch attached. This patch uses :json-null to distinguish, during pretty-print, between the value null and an empty object. All tests pass and many new tests are added. Best --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-pretty-printing-empty-objects-as-null.patch >From 78eb7b659809444f7c9690db73e1f65843d5658c Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sat, 19 May 2018 08:36:32 +0200 Subject: [PATCH] Fix pretty-printing empty objects as null * lisp/json.el (json-pretty-print): Force distinction between empty objects and null. (json-encode-list): Remove responsibility to print "null" as this value is not a list. (json-encode): Give higher precedence to lists so that an empty list is printed as an empty object, not as "null". * test/lisp/json-tests.el (test-json-encode): Add many tests to check the behavior of pretty-printing. --- lisp/json.el | 7 +++-- test/lisp/json-tests.el | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index d374f452e6..cd95ec2832 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -609,8 +609,7 @@ json-encode-list "Return a JSON representation of LIST. Tries to DWIM: simple lists become JSON arrays, while alists and plists become JSON objects." - (cond ((null list) "null") - ((json-alist-p list) (json-encode-alist list)) + (cond ((json-alist-p list) (json-encode-alist list)) ((json-plist-p list) (json-encode-plist list)) ((listp list) (json-encode-array list)) (t @@ -723,12 +722,12 @@ json-encode ((stringp object) (json-encode-string object)) ((keywordp object) (json-encode-string (substring (symbol-name object) 1))) + ((listp object) (json-encode-list object)) ((symbolp object) (json-encode-string (symbol-name object))) ((numberp object) (json-encode-number object)) ((arrayp object) (json-encode-array object)) ((hash-table-p object) (json-encode-hash-table object)) - ((listp object) (json-encode-list object)) (t (signal 'json-error (list object))))) ;; Pretty printing @@ -743,6 +742,8 @@ json-pretty-print (interactive "r") (atomic-change-group (let ((json-encoding-pretty-print t) + ;; Distinguish an empty objects from 'null' + (json-null :json-null) ;; Ensure that ordering is maintained (json-object-type 'alist) (txt (delete-and-extract-region begin end))) diff --git a/test/lisp/json-tests.el b/test/lisp/json-tests.el index ea562e8b13..84039c09ce 100644 --- a/test/lisp/json-tests.el +++ b/test/lisp/json-tests.el @@ -325,5 +325,72 @@ json-tests--with-temp-buffer (with-temp-buffer (should-error (json-encode (current-buffer)) :type 'json-error))) +;;; Pretty-print + +(defun json-tests-equal-pretty-print (original &optional expected) + "Abort current test if pretty-printing ORIGINAL does not yield EXPECTED. + +Both ORIGINAL and EXPECTED should be strings. If EXPECTED is +nil, ORIGINAL should stay unchanged by pretty-printing." + (with-temp-buffer + (insert original) + (json-pretty-print-buffer) + (should (equal (buffer-string) (or expected original))))) + +(ert-deftest test-json-pretty-print-string () + (json-tests-equal-pretty-print "\"\"") + (json-tests-equal-pretty-print "\"foo\"")) + +(ert-deftest test-json-pretty-print-atom () + (json-tests-equal-pretty-print "true") + (json-tests-equal-pretty-print "false") + (json-tests-equal-pretty-print "null")) + +(ert-deftest test-json-pretty-print-number () + (json-tests-equal-pretty-print "123") + (json-tests-equal-pretty-print "0.123")) + +(ert-deftest test-json-pretty-print-object () + ;; empty (regression test for bug#24252) + (json-tests-equal-pretty-print + "{}" + "{\n}") + ;; one pair + (json-tests-equal-pretty-print + "{\"key\":1}" + "{\n \"key\": 1\n}") + ;; two pairs + (json-tests-equal-pretty-print + "{\"key1\":1,\"key2\":2}" + "{\n \"key1\": 1,\n \"key2\": 2\n}") + ;; embedded object + (json-tests-equal-pretty-print + "{\"foo\":{\"key\":1}}" + "{\n \"foo\": {\n \"key\": 1\n }\n}") + ;; embedded array + (json-tests-equal-pretty-print + "{\"key\":[1,2]}" + "{\n \"key\": [\n 1,\n 2\n ]\n}")) + +(ert-deftest test-json-pretty-print-array () + ;; empty + (json-tests-equal-pretty-print "[]") + ;; one item + (json-tests-equal-pretty-print + "[1]" + "[\n 1\n]") + ;; two items + (json-tests-equal-pretty-print + "[1,2]" + "[\n 1,\n 2\n]") + ;; embedded object + (json-tests-equal-pretty-print + "[{\"key\":1}]" + "[\n {\n \"key\": 1\n }\n]") + ;; embedded array + (json-tests-equal-pretty-print + "[[1,2]]" + "[\n [\n 1,\n 2\n ]\n]")) + (provide 'json-tests) ;;; json-tests.el ends here -- 2.17.0 --=-=-= Content-Type: text/plain -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 11:21:59 2018 Received: (at 24252) by debbugs.gnu.org; 28 May 2018 15:21:59 +0000 Received: from localhost ([127.0.0.1]:52560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNJyB-0001sh-J6 for submit@debbugs.gnu.org; Mon, 28 May 2018 11:21:59 -0400 Received: from petton.fr ([89.234.186.68]:50680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNJy9-0001sU-6r for 24252@debbugs.gnu.org; Mon, 28 May 2018 11:21:57 -0400 From: Nicolas Petton To: Damien Cassou , Yoichi Nakayama Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object In-Reply-To: <87o9hci1c5.fsf@cassou.me> References: <87o9hci1c5.fsf@cassou.me> Date: Mon, 28 May 2018 17:21:46 +0200 Message-ID: <877enniz5h.fsf@petton.fr> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail; t=1527520910; bh=TeDgNNLOpa2uP0LMb91+qsasAEsS5YE8MiUOaEl+MZ8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type; b=YYJ5GDW/fsBLQwH/4b0JUVmG+OuXTMJB4qPTIv68xjGkCOuiDQf8IHJz76bzY44DrwwmM5zUJcPysMmd1oRPpCPSlZ441VxvZOjRxOCA2wU6DUgX7UO3B7M3AKVhIFDCUCgtNNos2Y3xJh8JJ7z0Qb7i+0RnxNMetsiWXqpjZLE= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24252 Cc: Philipp Stephani , Mark Oteiza , Theresa O'Connor , 24252@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Damien Cassou writes: > please find a patch attached. This patch uses :json-null to distinguish, > during pretty-print, between the value null and an empty object. It looks good to me, but I'm wondering if encoding/decoding (not pretty-printing) will be backward-compatible or not. Cheers, Nico --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE1AWqLIYsVPF+7mvg6LzXhmr8+XgFAlsMHooACgkQ6LzXhmr8 +Xi2+wf/fMCx+9w/yVlFfH9f8xhS3ii3JB6fllFyvZlxN6l815XWzBPd0fsSggVC PIH/eKtCTwUKpUY/jvx0BIUTy6wMTcsXkpkNIM3JdUMBGk6zynnDRifU9DFZ3HGy PAAk3vkEjz4BMK6MuWPhHMArmFMCUgtUe44Ip0ARrUURNabUS3AS4I3RcFRNpjDL JZ85emT/gRBFSxojsq4F2pU2tmCNwsRAU4+7dqIRDgGCUFz01Hur9/z6LEtk+Aba ctBd1xA7l90CwyxLELy8jeu5S2tvMOPmBmydwKQQoWgVLC2yP4RBaYnRh97cqMn+ lMuBveK+S8c+glurV6H9MD2oSB8NUQ== =PX9Q -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 11 09:36:45 2018 Received: (at 24252) by debbugs.gnu.org; 11 Jun 2018 13:36:45 +0000 Received: from localhost ([127.0.0.1]:42959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSN00-0007V2-UA for submit@debbugs.gnu.org; Mon, 11 Jun 2018 09:36:45 -0400 Received: from mail.choca.pics ([62.210.108.126]:39358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSMzx-0007Ur-CJ for 24252@debbugs.gnu.org; Mon, 11 Jun 2018 09:36:42 -0400 Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 204EC232446E; Mon, 11 Jun 2018 15:36:40 +0200 (CEST) Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id 7gwY38aKlCgd; Mon, 11 Jun 2018 15:36:38 +0200 (CEST) Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 12B672324473; Mon, 11 Jun 2018 15:36:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.choca.pics 12B672324473 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cassou.me; s=9EA44F5C-DEF4-11E6-A83F-A08DF322D8FB; t=1528724198; bh=Xj27UYUY/7YAlmpc2m+hSAq4OttzPX65Z8vre2rWJVw=; h=From:To:Date:Message-ID:MIME-Version; b=jElkHOqKIGk6hWSdoO5cbnqvvW4fYxw1dfgIp25WtkSsdhKAGb/sscVhDXqnqNSe6 eeiPSbQHD17JDH7I4mZw7/sysDmvAGGook3nwXo/UikL8lRM52gOtFrqFiwcnAztc4 oaCSk8cpZb47xNBaSI/1VKtWd7+HFgzC3qczR6++rkHvU0pdqYiIuoZQNKsjkH3hhw cS9vRiyRitAIIItgQEU2BOzIxfzbA1uT9OTRrEbM1WSAJlI/NB66HIryxvlb86+z6W DlW6f4rsoFZJiEBob67+LlpH0hEURAQAJNLpGZSdeOJL0uvN+820OcJMNylisFcNH4 WIAMNJq18WVMQ== X-Virus-Scanned: amavisd-new at choca.pics Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id BVqE3c3Y9pDM; Mon, 11 Jun 2018 15:36:37 +0200 (CEST) Received: from luz4 (31-211-216-84.customers.ownit.se [31.211.216.84]) by mail.choca.pics (Postfix) with ESMTPSA id 68563232446E; Mon, 11 Jun 2018 15:36:37 +0200 (CEST) From: Damien Cassou To: Nicolas Petton , Yoichi Nakayama Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object In-Reply-To: <877enniz5h.fsf@petton.fr> References: <87o9hci1c5.fsf@cassou.me> <877enniz5h.fsf@petton.fr> Date: Mon, 11 Jun 2018 15:36:35 +0200 Message-ID: <87tvq9v40s.fsf@cassou.me> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24252 Cc: Philipp Stephani , Mark Oteiza , Theresa O'Connor , 24252@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Nicolas Petton writes: > Damien Cassou writes: >> please find a patch attached. This patch uses :json-null to distinguish, >> during pretty-print, between the value null and an empty object. > > It looks good to me, but I'm wondering if encoding/decoding (not > pretty-printing) will be backward-compatible or not. no one who has worked on this module before is willing to review this small change? -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 12 13:14:35 2018 Received: (at 24252) by debbugs.gnu.org; 12 Jun 2018 17:14:35 +0000 Received: from localhost ([127.0.0.1]:45299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSmsI-0005cx-JJ for submit@debbugs.gnu.org; Tue, 12 Jun 2018 13:14:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSmsH-0005cl-UZ for 24252@debbugs.gnu.org; Tue, 12 Jun 2018 13:14:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSmsB-0006Dv-Ug for 24252@debbugs.gnu.org; Tue, 12 Jun 2018 13:14:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSms5-0006BL-QH; Tue, 12 Jun 2018 13:14:17 -0400 Received: from [176.228.60.248] (port=4188 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fSms5-0003Xl-64; Tue, 12 Jun 2018 13:14:17 -0400 Date: Tue, 12 Jun 2018 20:14:27 +0300 Message-Id: <83o9gg3p1o.fsf@gnu.org> From: Eli Zaretskii To: Damien Cassou In-reply-to: <87tvq9v40s.fsf@cassou.me> (message from Damien Cassou on Mon, 11 Jun 2018 15:36:35 +0200) Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object References: <87o9hci1c5.fsf@cassou.me> <877enniz5h.fsf@petton.fr> <87tvq9v40s.fsf@cassou.me> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 24252 Cc: mvoteiza@udel.edu, nicolas@petton.fr, phst@google.com, ted@oconnor.cx, 24252@debbugs.gnu.org, dgutov@yandex.ru, yoichi.nakayama@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Damien Cassou > Date: Mon, 11 Jun 2018 15:36:35 +0200 > Cc: Philipp Stephani , Mark Oteiza , > Theresa O'Connor , 24252@debbugs.gnu.org, > Dmitry Gutov > > Nicolas Petton writes: > > Damien Cassou writes: > >> please find a patch attached. This patch uses :json-null to distinguish, > >> during pretty-print, between the value null and an empty object. > > > > It looks good to me, but I'm wondering if encoding/decoding (not > > pretty-printing) will be backward-compatible or not. > > no one who has worked on this module before is willing to review this > small change? Sorry about that. From my POV, Nico asked a question that I didn't see answered, so the patch is still "being discussed", as far as I'm concerned. If you can address Nicolas's concern, we should be able to move ahead. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 13 03:13:16 2018 Received: (at 24252) by debbugs.gnu.org; 13 Jun 2018 07:13:16 +0000 Received: from localhost ([127.0.0.1]:45692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSzxz-00018R-Ti for submit@debbugs.gnu.org; Wed, 13 Jun 2018 03:13:16 -0400 Received: from mail.choca.pics ([62.210.108.126]:44738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSzxx-00018I-6m for 24252@debbugs.gnu.org; Wed, 13 Jun 2018 03:13:14 -0400 Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id E4AA223284CB; Wed, 13 Jun 2018 09:13:11 +0200 (CEST) Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id AJolzKcF_eNT; Wed, 13 Jun 2018 09:13:10 +0200 (CEST) Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id AFCA123284D5; Wed, 13 Jun 2018 09:13:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.choca.pics AFCA123284D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cassou.me; s=9EA44F5C-DEF4-11E6-A83F-A08DF322D8FB; t=1528873990; bh=SgyFztdhvK7FZzO5bQ7kx4kCyGhkaNxEC1ff5ZkAm44=; h=From:To:Date:Message-ID:MIME-Version; b=J7LeHSbabIkq+Gb8aADy7oRlb4FKRzFQ5XScoHHqfZB/dKVxghXzStTJYznysITEG P3cUQ43sypUKo12ntJ7gnrQqCQVe+EQS6TdkemATHpvpbLQ4a+a0vAziMNfz1DYu29 mTauNZ1oS5KPw+If4Ws+j83t/5egCfc6oDT8hjfFxbwzgsm4WbsXGUJGeJs4RX06D6 Gp/PlBK0LouJGN+uVl0EBljBjwA24K4wh1l8HJpfic9DmdnW6dYbpKdLBz+Ls71U04 UDXDjgQ6GTple8wEpIVscmzWxpMGeOyqx2NDV4JPfQsAetunWjpImP3S7K1Vda55F2 /TbaNfDkrNvXQ== X-Virus-Scanned: amavisd-new at choca.pics Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id tEUOue4y2nB1; Wed, 13 Jun 2018 09:13:10 +0200 (CEST) Received: from luz4 (31-211-216-84.customers.ownit.se [31.211.216.84]) by mail.choca.pics (Postfix) with ESMTPSA id ECB4623284CB; Wed, 13 Jun 2018 09:13:09 +0200 (CEST) From: Damien Cassou To: Eli Zaretskii Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object In-Reply-To: <83o9gg3p1o.fsf@gnu.org> References: <87o9hci1c5.fsf@cassou.me> <877enniz5h.fsf@petton.fr> <87tvq9v40s.fsf@cassou.me> <83o9gg3p1o.fsf@gnu.org> Date: Wed, 13 Jun 2018 09:13:06 +0200 Message-ID: <8736xrqhvh.fsf@cassou.me> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24252 Cc: mvoteiza@udel.edu, nicolas@petton.fr, phst@google.com, ted@oconnor.cx, 24252@debbugs.gnu.org, dgutov@yandex.ru, yoichi.nakayama@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > Nicolas Petton writes: >> It looks good to me, but I'm wondering if encoding/decoding (not >> pretty-printing) will be backward-compatible or not. > From my POV, Nico asked a question that I didn't see answered, so the > patch is still "being discussed", as far as I'm concerned. If you can > address Nicolas's concern, we should be able to move ahead. I understood Nico's message as a call for help from other Emacs maintainers, not from me :-). The new code is certainly *not* backward-compatible if you look at the details. For example, `json-encode-list` was sometimes printing `null` and it won't do that anymore. I see that as a bug fix because `null` is not a list but it clearly makes the code not backward compatible. On the other hand, all existing unit tests still pass and the patch includes a bunch of new ones. I have been using this patch since I wrote it with no problem at all. My opinion is that a new Emacs release based on master is far enough in the future to merge this patch now and see if any complaints come :-). At worst, we will find a bug and Emacs will gain a new unit test. -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 13 09:06:00 2018 Received: (at 24252) by debbugs.gnu.org; 13 Jun 2018 13:06:00 +0000 Received: from localhost ([127.0.0.1]:45854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fT5TM-0004pJ-B1 for submit@debbugs.gnu.org; Wed, 13 Jun 2018 09:06:00 -0400 Received: from petton.fr ([89.234.186.68]:40968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fT5TK-0004p3-D3 for 24252@debbugs.gnu.org; Wed, 13 Jun 2018 09:05:58 -0400 From: Nicolas Petton To: Damien Cassou , Eli Zaretskii Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object In-Reply-To: <8736xrqhvh.fsf@cassou.me> References: <87o9hci1c5.fsf@cassou.me> <877enniz5h.fsf@petton.fr> <87tvq9v40s.fsf@cassou.me> <83o9gg3p1o.fsf@gnu.org> <8736xrqhvh.fsf@cassou.me> Date: Wed, 13 Jun 2018 15:05:47 +0200 Message-ID: <87wov2q1jo.fsf@petton.fr> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail; t=1528895152; bh=kXIJ2UZNHxGswXgUzRjoXXJSCxXY9uQl/hZzLtOmPoU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type; b=YIJbKaJ0yi2hCOhnlUkr+MEKRxeQuJ7k80QdSJfyUy/H2hrobIA3hyoNU58I8zK2KEfFul4x0in3Ejq2z6i1ZHz1faKXPwmSFT2W4en3RsbHhx4VGpLztoYsV5KiAyU5xzxY8ZCdObuKE7Rmlkw0KBB0YPSiAWCsfH1WLDGJvQ8= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24252 Cc: mvoteiza@udel.edu, phst@google.com, ted@oconnor.cx, 24252@debbugs.gnu.org, dgutov@yandex.ru, yoichi.nakayama@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Damien Cassou writes: > I understood Nico's message as a call for help from other Emacs > maintainers, not from me :-). It was just a question :-) > The new code is certainly *not* backward-compatible if you look at the > details. For example, `json-encode-list` was sometimes printing `null` > and it won't do that anymore. I see that as a bug fix because `null` is > not a list but it clearly makes the code not backward compatible. > > On the other hand, all existing unit tests still pass and the patch > includes a bunch of new ones. I have been using this patch since I wrote > it with no problem at all. Seems fair to me. I think we should install the patch. Eli, do you agree? If so, I'll install it in master. Cheers, Nico --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE1AWqLIYsVPF+7mvg6LzXhmr8+XgFAlshFqsACgkQ6LzXhmr8 +XhzcQf/dpHkSkrRKacYRUXG0tCH11dOlNyyw5Y538DhU765VMHb+oNoCVHwyVH1 zzHAayYMy9C7e+taFuYwq0kI69t4Dom9lbqFrA2KqoWJxrV6rFSe6zckEPPA/ZHE LVQbP/4jgPxPY2cvo+Ha7UvyxrwDgE5+SdDvpGCK0q2eaucaUQTr4WxVqyYgHDXD 55rnkIqN0I2HxsQtjwm14cljyb4pVpONy/YRemKPTOqbwMc4lixWONUrkY3zg378 03SU9h72+P4By1k8JOSLK9m9+nU8f78LMrY2J2vg/029dW5r10dap1SePFYNQKw/ m+DRMKOrF7KdDQ9kTQMiVDwPJzuQkQ== =2MyT -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 13 12:55:36 2018 Received: (at 24252) by debbugs.gnu.org; 13 Jun 2018 16:55:36 +0000 Received: from localhost ([127.0.0.1]:46832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fT93S-0007n3-Py for submit@debbugs.gnu.org; Wed, 13 Jun 2018 12:55:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fT93R-0007mq-NA for 24252@debbugs.gnu.org; Wed, 13 Jun 2018 12:55:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fT93L-0003YZ-FR for 24252@debbugs.gnu.org; Wed, 13 Jun 2018 12:55:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT93D-0003EP-3g; Wed, 13 Jun 2018 12:55:15 -0400 Received: from [176.228.60.248] (port=1653 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fT93C-0007qX-Gf; Wed, 13 Jun 2018 12:55:14 -0400 Date: Wed, 13 Jun 2018 19:55:10 +0300 Message-Id: <83a7ry4oep.fsf@gnu.org> From: Eli Zaretskii To: Nicolas Petton In-reply-to: <87wov2q1jo.fsf@petton.fr> (message from Nicolas Petton on Wed, 13 Jun 2018 15:05:47 +0200) Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object References: <87o9hci1c5.fsf@cassou.me> <877enniz5h.fsf@petton.fr> <87tvq9v40s.fsf@cassou.me> <83o9gg3p1o.fsf@gnu.org> <8736xrqhvh.fsf@cassou.me> <87wov2q1jo.fsf@petton.fr> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 24252 Cc: mvoteiza@udel.edu, damien@cassou.me, phst@google.com, ted@oconnor.cx, 24252@debbugs.gnu.org, dgutov@yandex.ru, yoichi.nakayama@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Nicolas Petton > Cc: yoichi.nakayama@gmail.com, phst@google.com, mvoteiza@udel.edu, ted@oconnor.cx, 24252@debbugs.gnu.org, dgutov@yandex.ru > Date: Wed, 13 Jun 2018 15:05:47 +0200 > > Seems fair to me. I think we should install the patch. Eli, do you > agree? If so, I'll install it in master. It's okay for master, thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 14 05:04:38 2018 Received: (at 24252) by debbugs.gnu.org; 14 Jun 2018 09:04:39 +0000 Received: from localhost ([127.0.0.1]:47309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fTOBK-0008I7-MZ for submit@debbugs.gnu.org; Thu, 14 Jun 2018 05:04:38 -0400 Received: from petton.fr ([89.234.186.68]:41754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fTOBI-0008Hr-Qb; Thu, 14 Jun 2018 05:04:37 -0400 From: Nicolas Petton To: Eli Zaretskii Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object In-Reply-To: <83a7ry4oep.fsf@gnu.org> References: <87o9hci1c5.fsf@cassou.me> <877enniz5h.fsf@petton.fr> <87tvq9v40s.fsf@cassou.me> <83o9gg3p1o.fsf@gnu.org> <8736xrqhvh.fsf@cassou.me> <87wov2q1jo.fsf@petton.fr> <83a7ry4oep.fsf@gnu.org> Date: Thu, 14 Jun 2018 11:04:25 +0200 Message-ID: <87r2l9pwme.fsf@petton.fr> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail; t=1528967070; bh=qdJ7tLodinyV0lEcD5VOWkbIZ3QBytZAc3g4LS9NoFc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type; b=KHu906ii6i7yfh5ewmtL+oxSkNKKj9G4TiIpKoWJLEZo8kJypQrgfNkY1UVQ5xvqOV2iephvgPzqOe2WLt31iX4mh78ZMYhO+TuKqs64pUc4v1NUT4kZv7SgccSwQU+bZ/Tuj34biJgQ+PTqrLkDuqz/bcfsHjr7AsK6KyoNRTw= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24252 Cc: mvoteiza@udel.edu, damien@cassou.me, phst@google.com, ted@oconnor.cx, 24252@debbugs.gnu.org, dgutov@yandex.ru, yoichi.nakayama@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain tags 24252 fixed close 24252 27.1 thanks Eli Zaretskii writes: > It's okay for master, thanks. I installed it in master, so I'm closing this ticket. Cheers, Nico --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE1AWqLIYsVPF+7mvg6LzXhmr8+XgFAlsiL5kACgkQ6LzXhmr8 +XhA/ggA16OlZjk5xGlgjvE4P3kfOlGU4XBBVtUG2N1GueNbHzHRiXHtlAzVum7E 8mrc/qqmNGCdP9nM7E9WypI+VMyI4VGAl5Vkpd8oZiBlTe+U5JRlr+xZJ49IOruF S9EG2JF5AV5CTNrbNEoGFCrAg+Md/59rOzoR/uVnnnQTKsbJVj2IXw/MITd4eNkY UGyXfRrfdrCe0lFXob0bfv+srlj9x2lH/ZiWQ4Alk0LFQeIXVxbo1HzgNj13xOfX 7ruEY9wBtU5ld/Jrv0Vt+tNSRrIMIaic6k+LpPW65iWtPwCyMg7igJqWXtMAENHJ 70dO0PDHHKUlTKe4GlqntMS/fBE2HA== =oYT4 -----END PGP SIGNATURE----- --=-=-=-- From unknown Fri Aug 15 02:04:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 12 Jul 2018 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator