Streaming writer John Cowan (18 Jan 2020 21:52 UTC)
Re: Streaming writer Amirouche Boubekki (21 Jan 2020 10:38 UTC)
Re: Streaming writer Duy Nguyen (21 Jan 2020 13:00 UTC)
Re: Streaming writer Duy Nguyen (21 Jan 2020 13:31 UTC)
Indentation and sorted keys (Re: Streaming writer) Amirouche Boubekki (21 Jan 2020 14:47 UTC)
Re: Indentation and sorted keys (Re: Streaming writer) John Cowan (21 Jan 2020 17:01 UTC)
Respect insertion order from JSON text Amirouche Boubekki (21 Jan 2020 17:16 UTC)
Re: Indentation and sorted keys (Re: Streaming writer) Amirouche Boubekki (21 Jan 2020 17:41 UTC)
Re: Streaming writer John Cowan (21 Jan 2020 15:48 UTC)

Respect insertion order from JSON text Amirouche Boubekki 21 Jan 2020 17:16 UTC

Fixed in https://github.com/amirouche/srfi-180/commit/7b17e1dbc162b58713fe15ce7cd55dd088a6dde5

Le mar. 21 janv. 2020 à 18:01, John Cowan <xxxxxx@ccil.org> a écrit :
>
> Indeed, the latest ECMAscript standards require that in JavaScript objects are order preserving., recognizing the unfortunate-but-true fact that people do communicate information by the order of keys.  Fortunately for us, alists are too; you may need to reverse the alist before making it available.
>
> On Tue, Jan 21, 2020 at 9:47 AM Amirouche Boubekki <xxxxxx@gmail.com> wrote:
>>
>> Le mar. 21 janv. 2020 à 14:31, Duy Nguyen <xxxxxx@gmail.com> a écrit :
>> >
>> > On Tue, Jan 21, 2020 at 8:00 PM Duy Nguyen <xxxxxx@gmail.com> wrote:
>> > >
>> > > On Tue, Jan 21, 2020 at 5:38 PM Amirouche Boubekki
>> > > <xxxxxx@gmail.com> wrote:
>> > > >
>> > > > Le sam. 18 janv. 2020 à 22:52, John Cowan <xxxxxx@ccil.org> a écrit :
>> > > > >
>> > > > > I propose that json-stream-writer be added.  This accepts a port/accumulator and returns a procedure.  The contract for this procedure is the same as the procedure passed to json-stream-reader.  Any attempt to violate JSON rules of construction will signal an error satisfied by json-error?.
>> > > >
>> > > > Oh, that will allow to write a possibly bigger than memory JSON text?
>> > >
>> > > For me, that would allow me to customize the output (I hope) to print
>> > > json with indentation.
>> >
>>
>> I did not include sort-keys or indent keywords as of yet, for two reasons:
>>
>> a) It seems like the favorite way to provide keywords to a procedure
>> in a portable fashion will be SRFI-177
>> (https://srfi.schemers.org/srfi-177/) but it is not advancing (/me
>> winks at Lassi K.)
>>
>> b) I do not know how much interest there is in sorted keys and
>> indentation in json-write (or json-stream-write).  Basically, those
>> features are features for humans.  I quickly checked ActivityPub
>> standard and they do not require sorted keys, there is apparently no
>> standards that use sorted keys (or indentation).  That leads me to
>> think that is it (only) a feature to make it easier to read JSON
>> configuration files and there is jq [0] command line tool for that.
>>
>> [0] https://github.com/stedolan/jq
>>
>> That is, if there is a strong interest, I can add it provided we can
>> agree on a way to pass the keyword / optional arguments (or use
>> case-lambda...).

--
Amirouche ~ https://hyper.dev