GNU bug report logs - #34242
26.1; json-encode crudely rejects unwelcome objects

Previous Next

Package: emacs;

Reported by: phs <at> lsv.fr

Date: Tue, 29 Jan 2019 14:03:02 UTC

Severity: normal

Tags: fixed

Found in version 26.1

Fixed in version 27.1

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34242 in the body.
You can then email your comments to 34242 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34242; Package emacs. (Tue, 29 Jan 2019 14:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to phs <at> lsv.fr:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 29 Jan 2019 14:03:02 GMT) Full text and rfc822 format available.

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

From: phs <phs <at> lsv.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; json-encode crudely rejects unwelcome objects
Date: Tue, 29 Jan 2019 19:31:28 +0530
json-encode is supposed to return a JSON representation of its argument.

It fails on some objects:

  (setq debug-on-error t)
  (require 'json)

  (json-encode (list (list 1)))

  ==> Debugger entered--Lisp error: (json-key-format 1)

  (json-encode (list (cons (cons 'a 'b) 'a)))

  ==> Debugger entered--Lisp error: (wrong-type-argument listp a)

I understand that maybe not all objects make sense for json-encoding but
the documentation of json-encode does not specify what is a valid
argument, and (it seems) the package does not do it either.

Also the documentation does not list the error-codes so that we could
catch them in code.

--phs




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34242; Package emacs. (Tue, 09 Jul 2019 17:43:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: phs <phs <at> lsv.fr>
Cc: 34242 <at> debbugs.gnu.org
Subject: Re: bug#34242: 26.1; json-encode crudely rejects unwelcome objects
Date: Tue, 09 Jul 2019 19:42:19 +0200
phs <phs <at> lsv.fr> writes:

> json-encode is supposed to return a JSON representation of its argument.
>
> It fails on some objects:
>
>   (setq debug-on-error t)
>   (require 'json)
>
>   (json-encode (list (list 1)))
>
>   ==> Debugger entered--Lisp error: (json-key-format 1)
>
>   (json-encode (list (cons (cons 'a 'b) 'a)))
>
>   ==> Debugger entered--Lisp error: (wrong-type-argument listp a)
>
> I understand that maybe not all objects make sense for json-encoding but
> the documentation of json-encode does not specify what is a valid
> argument, and (it seems) the package does not do it either.
>
> Also the documentation does not list the error-codes so that we could
> catch them in code.

I've now added some text to this function (and json-read) about what the
inputs, return values are and what error signals are raised to the Emacs
trunk.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 09 Jul 2019 17:43:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 34242 <at> debbugs.gnu.org and phs <at> lsv.fr Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 09 Jul 2019 17:43:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Aug 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 235 days ago.

Previous Next


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