From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yoichi Nakayama Newsgroups: gmane.emacs.bugs Subject: bug#24252: 25.1; json.el doesn't distinguish null and empty object Date: Sun, 21 Aug 2016 15:06:02 +0000 Message-ID: References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> <4d97b2a8-5b96-6c22-7b00-95ef8bd5f6fd@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c19c026b5011d053a964594 X-Trace: blaine.gmane.org 1471792044 24339 195.159.176.226 (21 Aug 2016 15:07:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 21 Aug 2016 15:07:24 +0000 (UTC) Cc: 24252@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 21 17:07:19 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbULG-0005w4-4Q for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 Aug 2016 17:07:18 +0200 Original-Received: from localhost ([::1]:37212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbULD-0004nJ-FK for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 Aug 2016 11:07:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbUL4-0004n0-8B for bug-gnu-emacs@gnu.org; Sun, 21 Aug 2016 11:07:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbUKz-00067V-TG for bug-gnu-emacs@gnu.org; Sun, 21 Aug 2016 11:07:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbUKz-00067P-PE for bug-gnu-emacs@gnu.org; Sun, 21 Aug 2016 11:07:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bbUKz-0007aL-Hv for bug-gnu-emacs@gnu.org; Sun, 21 Aug 2016 11:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yoichi Nakayama Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Aug 2016 15:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24252 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24252-submit@debbugs.gnu.org id=B24252.147179198129103 (code B ref 24252); Sun, 21 Aug 2016 15:07:01 +0000 Original-Received: (at 24252) by debbugs.gnu.org; 21 Aug 2016 15:06:21 +0000 Original-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 Original-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 Original-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) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122454 Archived-At: --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--