[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15097: 24.3.50; json.el can't encode lists of lists
From: |
Glenn Morris |
Subject: |
bug#15097: 24.3.50; json.el can't encode lists of lists |
Date: |
Wed, 14 Aug 2013 21:55:50 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Rolando Pereira wrote:
> 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)
[...]
> (ert-should (string= (json-encode '((1 2 3))) "[[1,2,3]]")) ; doesn't work
I have no idea what this stuff is supposed to do, but by inspection it
treats such arguments as alists and requires that the key be encodable
as a string. Eg this works
(json-encode '((a 2 3))) -> "{\"a\":[2, 3]}"
Your example fails because 1 is encoded as 1, not "1".
Should the answer be "{\"1\":[2, 3]} or "[[1,2,3]]"?