Subject: Re: bug#70007: [PATCH] native JSON encoder

From: Eli Zaretskii <[email-masked]>
Date: Sat, 24 Aug 2024 19:14:22 +0300

> From: Mattias Engdegård <[email-masked]>
> Date: Sat, 24 Aug 2024 17:33:33 +0200
> Cc: Yuan Fu <[email-masked]>,
>  [email-masked]
> 
> (I'm going through some old unfinished work.)
> 
> The only major issue remaining here would be whether `json-serialize` should return a multibyte string, as it does now, or a unibyte string. I think we agree that unibyte is the correct choice in general, and since the code is new in Emacs 30 we should make a decision now because changing it in Emacs 31 will be riskier. On the other hand, the old libjansson implementation returned a multibyte string.
> 
> I've looked at packages using the API and they appear entirely agnostic -- the result is almost always a string that is fed into `process-send-string`.

We are very late in the release process to make such changes without
reservations.  We should have discussed this much earlier, but that's
water under the bridge.

Since this could potentially (albeit unlikely) break someone's code,
I'm okay with making this change, but with a twist: let's have a
variable which could be let-bound around the call to json-serialize,
to make the result a multibyte string instead of the default unibyte.
This is so if someone comes back crying that we broke his/her code,
they could have an easy fire escape.

OK?

P.S. Of course, the fact that the result is a unibyte string should be
mentioned in the doc string.