Subject: Re: bug#24252: 25.1; json.el doesn't distinguish null and empty object

From: Dmitry Gutov <[email-masked]>
Date: Sat, 20 Aug 2016 03:52:29 +0300

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.