GNU bug report logs - #42733
27.1; json-serialize doesn't not encode list like json-encode

Previous Next

Package: emacs;

Reported by: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>

Date: Thu, 6 Aug 2020 22:18:02 UTC

Severity: normal

Tags: moreinfo, notabug

Found in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
Cc: 42733 <at> debbugs.gnu.org, Philipp Stephani <phst <at> google.com>
Subject: Re: bug#42733: 27.1; json-serialize doesn't not encode list like
 json-encode
Date: Sat, 12 Jun 2021 14:53:41 +0200
Jimmy Yuen Ho Wong <wyuenho <at> 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




This bug report was last modified 3 years and 322 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.