From: Tim Landscheidt <tim@tim-landscheidt.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Help with list of list object passed to json-encode
Date: Sun, 29 May 2022 08:43:55 +0000 [thread overview]
Message-ID: <871qwcohis.fsf@vagabond.tim-landscheidt.de> (raw)
In-Reply-To: CAFyQvY03dVbdNosWaswpjXKZBQ0Jc+Y6PnbFqzJYoqWDs47JzA@mail.gmail.com
Kaushal Modi <kaushal.modi@gmail.com> wrote:
> I was experimenting with passing different s-exp objects to
> json-encode, and realized that this fails:
> (json-encode '((foo . ((1 2) (3 4 5)))))
> […]
> But this passes:
> (json-encode '((foo . [(1 2) (3 4 5)])))
> I'd like to understand why it's so.. Or is this a bug?
Probably not. An association list is just a list of cons
(and thus may also be a list of lists). Whether to treat it
as a "simple" list or an association list just depends on
the function which the programmer calls on them, there is no
"association list type". A vector on the other hand is a
different data type and can thus be discerned from (associa-
tion) lists.
Tim
prev parent reply other threads:[~2022-05-29 8:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 2:28 Help with list of list object passed to json-encode Kaushal Modi
2022-05-29 8:43 ` Tim Landscheidt [this message]
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=871qwcohis.fsf@vagabond.tim-landscheidt.de \
--to=tim@tim-landscheidt.de \
--cc=help-gnu-emacs@gnu.org \
/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.
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).