Indentation and sorted keys (Re: Streaming writer) Amirouche Boubekki 21 Jan 2020 14:47 UTC
Le mar. 21 janv. 2020 à 14:31, Duy Nguyen <firstname.lastname@example.org> a écrit : > > On Tue, Jan 21, 2020 at 8:00 PM Duy Nguyen <email@example.com> wrote: > > > > On Tue, Jan 21, 2020 at 5:38 PM Amirouche Boubekki > > <firstname.lastname@example.org> wrote: > > > > > > Le sam. 18 janv. 2020 à 22:52, John Cowan <email@example.com> 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  command line tool for that.  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...).