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

From: "Edward O'Connor" <[email-masked]>
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 <[email-masked]> 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