On Wed, Jan 22, 2020 at 5:33 PM Lassi Kortela <xxxxxx@lassi.io> wrote:

Agreed. That sounds too complex. Unless Amirouche wants it, since it's
his SRFI.

What the SRFI specifies doesn't have to be exactly what the sample implementation does.  In particular, underspecifying the output means that anybody's JSON writer can be made to conform without further effort.  

This is an important general point about SRFIs: reimplementation according to the text, without looking at the sample implementation, should be possible and conformant.

Would it work to just accept a (less? key1 key2) predicate? Maybe the
enum SRFI can provide a predicate-maker.

Yes, but I don't think key ordering belongs as a json-pp behavior.  If you sort the alist before calling json-write you get what you want, provided that the SRFI specifies that the members of an object are written in the order passed to json-write.
Racket has `writeln` and `displayln`. Both are so useful, I wish they
were standard.

Wirite a SRFI!

json-pp should probably allow a custom indent string (N spaces or a tab)
since people will probably want to write files that conform to the style
used in some existing collection of JSON files.

Allowing callers to specify that  or any other detail of the whitespace is inconsistent with leaving the result unspecified.  And tabs suck.  :-)

John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
One art / There is / No less / No more
To do / All things / With sparks / Galore   --Douglas Hofstadter