GNU bug report logs - #15097
24.3.50; json.el can't encode lists of lists

Previous Next

Package: emacs;

Reported by: Rolando Pereira <rolando_pereira <at> sapo.pt>

Date: Wed, 14 Aug 2013 22:46:02 UTC

Severity: normal

Found in version 24.3.50

Done: Daniel Colascione <dancol <at> dancol.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Glenn Morris <rgm <at> gnu.org>
To: Rolando Pereira <rolando_pereira <at> sapo.pt>
Cc: 15097 <at> debbugs.gnu.org
Subject: bug#15097: 24.3.50; json.el can't encode lists of lists
Date: Wed, 14 Aug 2013 21:55:50 -0400
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]]"?




This bug report was last modified 11 years and 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.