From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70007: [PATCH] native JSON encoder Date: Tue, 26 Mar 2024 18:46:00 +0200 Message-ID: <86wmpphrg7.fsf@gnu.org> References: <1BF559D1-DB9F-4FEB-90ED-72E0EFD76424@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32088"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70007@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 26 17:47:22 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rp9xI-00085l-6R for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Mar 2024 17:47:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rp9x8-0006qt-4u; Tue, 26 Mar 2024 12:47:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rp9x3-0006iy-9p for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 12:47:05 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rp9x0-0000LL-JN for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 12:47:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rp9x0-0005MJ-4d for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 12:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Mar 2024 16:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70007 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70007-submit@debbugs.gnu.org id=B70007.171147158620550 (code B ref 70007); Tue, 26 Mar 2024 16:47:02 +0000 Original-Received: (at 70007) by debbugs.gnu.org; 26 Mar 2024 16:46:26 +0000 Original-Received: from localhost ([127.0.0.1]:34791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rp9wQ-0005LO-Gt for submit@debbugs.gnu.org; Tue, 26 Mar 2024 12:46:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rp9wO-0005Kr-0r for 70007@debbugs.gnu.org; Tue, 26 Mar 2024 12:46:24 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rp9wH-0008Ub-Q9; Tue, 26 Mar 2024 12:46:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=D8erITFuTYCwhWSH92t8Ii9tlmx8pFHA41qcO919Qv8=; b=A1rNwi8EwUDLuUNj+HJZ ho0Al2cQ0BHV+OGcq0Oizk2oaaMMP4HOsWKxzJbuY7zL8ET1O9nQ3Yv9nGKSfG2axHzAX+IxRaG3K h8+IcpkmBS/ixhCjLSfnGaU+y+vPulx3w2xJNajVIK1dvaV9wVZ1YenoFY2O8fDDv6nXrjM8jnyHz SzBprmeDNRMIyJDfxhfquC0LN+SUvdGtSlw+bLxuUnLpuFpZRiuXMCJi+6D5zZEsUBi8eQ+6CuPg0 qKeYbYxdRYwysrnr+o32vNcH0dlU+ne4vkms/LQwb/kQxcOqYpQ5DcaM4Ndeb8Cng4nZfe4+RvH2w 03H0h99Pb/7QEg==; In-Reply-To: <1BF559D1-DB9F-4FEB-90ED-72E0EFD76424@gmail.com> (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Tue, 26 Mar 2024 16:33:52 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282098 Archived-At: > From: Mattias EngdegÄrd > Date: Tue, 26 Mar 2024 16:33:52 +0100 > > If we replace the lisp-to-JSON encoder with native code, we would not need the jansson library for it and it would be faster. > > There is ongoing work on a JSON-to-lisp parser, but the author has made it clear that he does not have time to write an encoder, so I spent a morning mashing up the attached patch. Thanks for working on this. > It generally produces the same result as the old code, except: > > - The old code incorrectly accepted strings with non-Unicode characters (raw bytes). There is no reason to do this; JSON is UTF-8 only. Would it complicate the code not to reject raw bytes? I'd like to avoid incompatibilities if it's practical. Also, Emacs traditionally doesn't reject raw bytes, leaving that to the application or the user. > I'd be very happy if someone could test it with packages that use this interface (json-serialise, json-insert). Yes, please.