Pretty-printing JSON Lassi Kortela 22 Jan 2020 00:21 UTC

> By outboard I mean using an external tool like "jq .", which
> prettyprints its output after doing a null transformation on it.

I also use "jq ." all the time, but keep wishing the original JSON was
indented so I didn't have to do that :) Almost none of the JSON dumps
are big enough that pretty-printing would cause a performance problem.

> This would have to be an option to write-json, to prettyprint or not. I
> hate options.  :-)

Several Schemes have a `pretty-print` or `pp` procedure for
S-expressions. There could be a JSON equivalent `json-pretty-print`, for

As Alan Perlis, Rich Hickey and many others have noted, having more
procedures does not make the system more complex. It's only procedures
that have to interact with each other that add complexity. The pretty
printer can be separate from the writer (naturally the implementations
would share many internals).

But if `json-write` writes a condensed format like Scheme `write`, is it
much different from a `json-write-line` that would write a JSON Lines
compatible value? Would there in fact be any difference other than a
final newline?