|
From: | Dmitry Gutov |
Subject: | bug#24252: 25.1; json.el doesn't distinguish null and empty object |
Date: | Sat, 20 Aug 2016 03:52:29 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |