[racket] Json pretty-print
40 minutes ago, Nick Shelley wrote:
> I'm pretty sure what I want is the easy thing. We have data
> represented as json, and we want changes to it to be easy to see in
> a difftool. Everything on one line makes this hard. We just have a
> bunch of nested arrays and dictionaries that need to be tabbed and
> newlined with no regard to width.
If the goal is just diffing, then it makes things a little different:
you'll want newlines, and you won't care about indentation. But a
better solution would be to find a diff tool that works on the line,
or even better a tree diff thing...
Alternatively, you could just pretty-print the Racket value and use
that output for the diff.
> As far as order goes, I think Python alphabetizes the keys, but for
> our purposes, order isn't important as long as it's consistent (so
> we don't get diffs that just change the order).
You definitely want the keys sorted -- Racket hash tables don't
guarantee some specific order, and it's likely to change from run to
run.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!