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


Message #20 received at 15097 <at> debbugs.gnu.org (full text, mbox):

From: "Edward O'Connor" <hober0 <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Rolando Pereira <rolando_pereira <at> sapo.pt>, 15097 <at> debbugs.gnu.org
Subject: Re: bug#15097: 24.3.50; json.el can't encode lists of lists
Date: Tue, 20 Aug 2013 13:16:25 -0700
The basic problem is that (("a" 1 2)) is the same thing as (("a" . (1
2))). Is that a list of one three-item list, or is it an alist with
one entry, whose key is "a" and whose value is a two-item list? It
might be reasonable for `json-encode-list' to provide programmatic
control over this, but the current behavior isn't a bug.

On Tue, Aug 20, 2013 at 10:04 AM, Glenn Morris <rgm <at> gnu.org> wrote:
> Rolando Pereira wrote:
>
>> Python 2.7.3 (default, Aug  1 2012, 05:16:07)
>> [GCC 4.6.3] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import json
>>>>> json.dumps([[1,2,3]])
>> '[[1, 2, 3]]'
>
> Well, maybe that's the actual issue, since json.el and the python
> version apparently disagree about what to do in such cases. Eg:
>
> (json-encode '(("a" 2 3)))  ->  "{\"a\":[2, 3]}"
> json.dumps([["a",2,3]])     ->  [["a", 2, 3]]
>
>
> (Context is at http://debbugs.gnu.org/15097 )
>



-- 
Edward O'Connor




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.