bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Damien Cassou
Subject: bug#24252: 25.1; json.el doesn't distinguish null and empty object
Date: Sat, 19 May 2018 08:52:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Yoichi Nakayama <yoichi.nakayama@gmail.com> writes:
> When json-pretty-print applied to "{}", it is
> unexpectedly converted to "null".
> This is caused by internal representations of null
> and empty object are the same:
>   (json-read-from-string "{}") ; => nil
>   (json-read-from-string "null") ; => nil

please find a patch attached. This patch uses :json-null to distinguish,
during pretty-print, between the value null and an empty object.

All tests pass and many new tests are added.

Best

Attachment: 0001-Fix-pretty-printing-empty-objects-as-null.patch
Description: Text Data

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

reply via email to

[Prev in Thread] Current Thread [Next in Thread]