bug#41946: 27.0.91; native json parsing: add :empty-object configuration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#41946: 27.0.91; native json parsing: add :empty-object configuration

Ivan Yonchovski

This is similar to :null-object/:false-object flags in
json-parse-string and solves the same issue - inability to distinguish
json's null from {}.



Reply | Threaded
Open this post in threaded view
|

bug#41946: 27.0.91; native json parsing: add :empty-object configuration

Eli Zaretskii
> From: Ivan Yonchovski <[hidden email]>
> Date: Fri, 19 Jun 2020 08:52:57 +0300
>
>
> This is similar to :null-object/:false-object flags in
> json-parse-string and solves the same issue - inability to distinguish
> json's null from {}.

I don't think I understand the request.  Can you post more details,
please?  (Maybe it's some standard JSON feature that I'm not familiar
with?)



Reply | Threaded
Open this post in threaded view
|

bug#41946: 27.0.91; native json parsing: add :empty-object configuration

Ivan Yonchovski
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.

Thanks,
Ivan

On Fri, Jun 19, 2020 at 10:30 AM Eli Zaretskii <[hidden email]> wrote:
> From: Ivan Yonchovski <[hidden email]>
> Date: Fri, 19 Jun 2020 08:52:57 +0300
>
>
> This is similar to :null-object/:false-object flags in
> json-parse-string and solves the same issue - inability to distinguish
> json's null from {}.

I don't think I understand the request.  Can you post more details,
please?  (Maybe it's some standard JSON feature that I'm not familiar
with?)