|
From: | yyoncho |
Subject: | bug#41946: 27.0.91; native json parsing: add :empty-object configuration |
Date: | Sat, 31 Jul 2021 18:51:02 +0300 |
yyoncho <yyoncho@gmail.com> writes:
> Sorry, for the short description. Here it is what I can do now:
>
> (json-parse-string "{\"a\":null}"
> :object-type 'plist
> :null-object :null-object)
> => (:a :null-object)
>
> Here it is what I want to be able to do also:
>
> (json-parse-string "{\"a\":{}}"
> :object-type 'plist
> :empty-object :empty)
> => (:a :empty)
>
> The purpose of this flag is to be able to distinguish json's null from json's empty
> object.
> ATM this could be achieved only by binding null. I want to be able to bind an
> empty object as well.
I'm not sure I understand the request.
(json-parse-string "{\"a\":null, \"b\":{}}"
:object-type 'plist)
=> (:a :null :b nil)
(json-parse-string "{\"a\":null, \"b\":{}}"
:object-type 'plist
:null-object :null-object)
=> (:a :null-object :b nil)
By binding :null-object, you can distinguish these objects already, so
:empty-object would just be the opposite? And you can do that in
post-filtering if you want something like that.
But I've added Philipp to the CCs; perhaps he has a comment here.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
[Prev in Thread] | Current Thread | [Next in Thread] |