Subject: bug#15097: closed (Wontfix, apparently)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 23 Mar 2014 06:41:04 +0000

Your bug report

#15097: 24.3.50; json.el can't encode lists of lists

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
15097: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15097
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Wontfix, apparently
From: Daniel Colascione <[email-masked]>
To: [email-masked]
Date: Sat, 22 Mar 2014 23:40:19 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Wontfix according to discussion

Subject: 24.3.50; json.el can't encode lists of lists
From: Rolando Pereira <[email-masked]>
To: [email-masked]
Date: Wed, 14 Aug 2013 23:44:36 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello all,

The function `json-encode' can't encode a list thats composed only of other
lists, i.e. the following doesn't work:

    (json-encode '((1 2 3))) => Error: (json-key-format 1)

If I had an extra "nil" in the topmost list `json-encode' then it works
fine:

    (json-encode '((1 2 3) nil)) => "[[1,2,3],null]"

However if I replace the `nil' with another list then I get the same
error:

    (json-encode '((1 2 3) (4))) => Error: (json-key-format 1)

Here's a small ERT test that should trigger the bug:

    (ert-deftest json-encode-list-of-lists-test ()
      (ert-should (string= (json-encode '(1 2 3)) "[1,2,3]"))              ; works
      (ert-should (string= (json-encode '((1) 2 3)) "[[1],2,3]"))          ; works
      (ert-should (string= (json-encode '((1 2 3))) "[[1,2,3]]"))          ; doesn't work
      (ert-should (string= (json-encode '((1 2 3) nil)) "[[1,2,3],null]")) ; works
      (ert-should (string= (json-encode '((1 2 3) (4))) "[[1,2,3],[4]]"))  ; doesn't work
      )

Best regards,
Rolando Pereira