unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: Rolando Pereira <rolando_pereira@sapo.pt>
Cc: 15097@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	[thread overview]
Message-ID: <es4narsont.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87pptf7uzv.fsf@sapo.pt>

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]]"?





  reply	other threads:[~2013-08-15  1:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14 22:44 bug#15097: 24.3.50; json.el can't encode lists of lists Rolando Pereira
2013-08-15  1:55 ` Glenn Morris [this message]
2013-08-19 22:09   ` Rolando Pereira
2013-08-19 22:09   ` Rolando Pereira
2013-08-20 17:04     ` Glenn Morris
2013-08-20 20:16       ` Edward O'Connor
2014-03-23  6:40 ` bug#15097: Wontfix, apparently Daniel Colascione

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=es4narsont.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=15097@debbugs.gnu.org \
    --cc=rolando_pereira@sapo.pt \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).