all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: yyoncho <yyoncho@gmail.com>
Cc: Philipp Stephani <phst@google.com>, 41946@debbugs.gnu.org
Subject: bug#41946: 27.0.91; native json parsing: add :empty-object configuration
Date: Sat, 31 Jul 2021 17:07:01 +0200	[thread overview]
Message-ID: <87fsvued4a.fsf@gnus.org> (raw)
In-Reply-To: <CACCVLQXsdAMYXNaitrLZ5pRzzbeuzxsx0ZR_gFLqtgQfCU6d=Q@mail.gmail.com> (yyoncho@gmail.com's message of "Fri, 19 Jun 2020 11:07:27 +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





  reply	other threads:[~2021-07-31 15:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19  5:52 bug#41946: 27.0.91; native json parsing: add :empty-object configuration Ivan Yonchovski
2020-06-19  7:29 ` Eli Zaretskii
2020-06-19  8:07   ` yyoncho
2021-07-31 15:07     ` Lars Ingebrigtsen [this message]
2021-07-31 15:51       ` yyoncho
2021-07-31 16:12         ` Lars Ingebrigtsen
2021-08-01 23:53           ` Dmitry Gutov
2021-08-04  5:55             ` Lars Ingebrigtsen
2021-08-04 10:54               ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsvued4a.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=41946@debbugs.gnu.org \
    --cc=phst@google.com \
    --cc=yyoncho@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.