From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#24252: 25.1; json.el doesn't distinguish null and empty object Date: Sat, 20 Aug 2016 03:52:29 +0300 Message-ID: References: <0e859022-309d-576d-62ea-acaddb10a0c2@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1471654399 7200 195.159.176.226 (20 Aug 2016 00:53:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 20 Aug 2016 00:53:19 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0 Cc: 24252@debbugs.gnu.org To: Yoichi Nakayama Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 20 02:53:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bauXD-0001fD-PH for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Aug 2016 02:53:15 +0200 Original-Received: from localhost ([::1]:59473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bauXC-0008I3-40 for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Aug 2016 20:53:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bauX6-0008Gr-Qu for bug-gnu-emacs@gnu.org; Fri, 19 Aug 2016 20:53:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bauX0-00054Z-Pg for bug-gnu-emacs@gnu.org; Fri, 19 Aug 2016 20:53:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bauX0-00054R-Li for bug-gnu-emacs@gnu.org; Fri, 19 Aug 2016 20:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bauX0-0000vu-7t for bug-gnu-emacs@gnu.org; Fri, 19 Aug 2016 20:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Aug 2016 00:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24252 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24252-submit@debbugs.gnu.org id=B24252.14716543603555 (code B ref 24252); Sat, 20 Aug 2016 00:53:02 +0000 Original-Received: (at 24252) by debbugs.gnu.org; 20 Aug 2016 00:52:40 +0000 Original-Received: from localhost ([127.0.0.1]:34582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bauWd-0000vG-5L for submit@debbugs.gnu.org; Fri, 19 Aug 2016 20:52:40 -0400 Original-Received: from mail-lf0-f47.google.com ([209.85.215.47]:34598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bauWb-0000v0-Lv for 24252@debbugs.gnu.org; Fri, 19 Aug 2016 20:52:38 -0400 Original-Received: by mail-lf0-f47.google.com with SMTP id l89so43461694lfi.1 for <24252@debbugs.gnu.org>; Fri, 19 Aug 2016 17:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=MR+tzzRoJh6eRatfLfSsnpZ6kfV2MBC2pOwdQp+FFM0=; b=K+5l2IFwtuzlTh7GhHXgc9bzwQsbh9Bgp3/ZbAHnzW8P4TQa5G2sRPBfBnpPwg267Q 5sa58UBWG8GwG1QlIqvnQSRdZkcLv9eSVHSP+8U6cdOYyXIXKFfH09aoGl6OIG+WtwPp YH483054U9x9slQydUpdiZuG119mMcowGEV02toSoW/0RZudfFVbjw290AVtuiIJyq42 4maWhcjxk8CYwNzPoVGH2y2G6pBZ9Pf+yMkcrqJf8ii9ij7gD7r4ddKPFVwKr0Zj14Yj fj8xWiIdo1LcIzYS9IJKdO0SrBpZlOaGNHb1SJEnsmkbuunK5aUPVdHtGneWsuUVAAIr /Evg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=MR+tzzRoJh6eRatfLfSsnpZ6kfV2MBC2pOwdQp+FFM0=; b=G3oGGrjsNec5Oe2wDZoIHlAdJG/J8J8eP0NKsqGcaINPLqolQDWbBWS+NwzTq7/Nfb WtMhIsNkXb8JpLd1co8w+7pmOK/HF5aSCsGw4DNsKJxmhmm19FegFbDJr+UIjKVE0gH8 PfljzsrbuLm0F3fMj0ySTec5xtNVCpNkq/LAqUd8eSMGnazCa5s4XmBAGC3zjiDJAi3p bhAw1RKCQ2jFGAvlp6Pghy5HgC7s5Iwlr13u/FExZDxUlCGAv02Bekz1mzJGx4TTsy7+ xDYW2LbWTAcHGv/Vguonri2uPZu46q0LnPiahsG+2JBCo9zGY44EqJGaE4ESXmZIhZv4 ijWw== X-Gm-Message-State: AEkoouvJuILPqNd6ZUHHlPiPiy+8v+Thg+CixFQZL4qRA6mzbFZqEFICXhjlzBZVLC1i0g== X-Received: by 10.25.205.137 with SMTP id d131mr2856192lfg.189.1471654351589; Fri, 19 Aug 2016 17:52:31 -0700 (PDT) Original-Received: from [192.168.1.190] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id h65sm1638317lji.29.2016.08.19.17.52.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Aug 2016 17:52:30 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122397 Archived-At: On 08/20/2016 02:45 AM, Yoichi Nakayama wrote: >> Why don't you bind json-null to whatever value you need? > > (let ((json-null 'NULL)) (json-encode (json-read-from-string "{}"))) > "\"nil\"" Okay then: ELISP> (let ((json-object-type 'hash-table)) (json-encode (json-read-from-string "{}"))) "{}" >> By the way, another option to distinguish nil and {} is to bind json-object-type to `hash-table'. An empty hash table is not nil. > > It does not work because Where/how doesn't it work? > json-pretty-print overwrites json-object-type. Maybe the fix could be in json-pretty-print.