unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Cc: 42733@debbugs.gnu.org, Philipp Stephani <phst@google.com>
Subject: bug#42733: 27.1; json-serialize doesn't not encode list like json-encode
Date: Sat, 12 Jun 2021 14:53:41 +0200	[thread overview]
Message-ID: <875yyj6y7e.fsf@gnus.org> (raw)
In-Reply-To: <m2v9hvzaes.fsf@gmail.com> (Jimmy Yuen Ho Wong's message of "Thu,  06 Aug 2020 23:17:47 +0100")

Jimmy Yuen Ho Wong <wyuenho@gmail.com> writes:

> (json-encode '("foo" "bar"))
> => "[\"foo\",\"bar\"]"
>
> (json-serialize '("foo" "bar"))
>
> Debugger entered--Lisp error: (wrong-type-argument symbolp "foo")
>   json-serialize(("foo" "bar"))
>
> The potential for people to naively substitute json-encode with
> json-serialize and breaking their code is enormous. This is already
> happening in lsp-mode. Please make json-serialize behave like
> json-encode.

json.c is a lot less "DWIM" than json.el -- which I think is generally a
good idea when it comes to doing round-trips between Elisp and JSON,
because you avoid a lot of corner cases.

So I'd be inclined to just regard this as a feature, but I've added
Philipp to the CCs -- perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  parent reply	other threads:[~2021-06-12 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 22:17 bug#42733: 27.1; json-serialize doesn't not encode list like json-encode Jimmy Yuen Ho Wong
2020-08-06 22:29 ` bug#42733: 27.1; json-serialize does " Jimmy Yuen Ho Wong
2020-08-07  2:18   ` 황병희
2021-06-12 12:53 ` Lars Ingebrigtsen [this message]
2021-07-05 17:45   ` bug#42733: 27.1; json-serialize doesn't " Philipp
2021-07-05 19:48     ` Lars Ingebrigtsen

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=875yyj6y7e.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=42733@debbugs.gnu.org \
    --cc=phst@google.com \
    --cc=wyuenho@gmail.com \
    /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).