all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: yyoncho <yyoncho@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
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 18:51:02 +0300	[thread overview]
Message-ID: <CACCVLQXtCnuYkZ42mjJJR=1s9XeVdqmRz_ZWes8ouxnXLW4CEw@mail.gmail.com> (raw)
In-Reply-To: <87fsvued4a.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

We already have 20k+ LOC project using json null as nil and rebinding it
will force us to rewrite a great portion of the if statements.

Thanks,
Ivan

On Sat, Jul 31, 2021 at 6:07 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> 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
>

[-- Attachment #2: Type: text/html, Size: 2503 bytes --]

  reply	other threads:[~2021-07-31 15:51 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
2021-07-31 15:51       ` yyoncho [this message]
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='CACCVLQXtCnuYkZ42mjJJR=1s9XeVdqmRz_ZWes8ouxnXLW4CEw@mail.gmail.com' \
    --to=yyoncho@gmail.com \
    --cc=41946@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=phst@google.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.