Closed mattinbits closed 7 years ago
Hi guys, should CompactPrinter also has such ordering?
Hi @tonyamelnychuk it was not a goal of this PR to do that, but I can imagine this could be useful functionality in other use cases. Given this is an old, closed PR, the best course of action may be to create a new issue or PR for the requirement.
This method prints in the same format as PrettyPrinter but sorts the keys of each object lexicographically.
The impetus for this change was this question: http://stackoverflow.com/questions/31418626/sort-fields-in-rendered-json
In general it is useful to be able to have more deterministic control over the ordering of output, if diff tools are to be used.
As per the README, I'm happy to license the work to the spray-json project under the project’s open source license. Wasn't sure what to put as a licence header in each file. If you let me know, I'll update the PR accordingly.