Search code examples
spray-json

Sort fields in rendered JSON


Using Spray JSON, how can I render the objects with their fields alphanumerically sorted?

My objective is to get sorted output so that I can use text-only diff tools.


Solution

  • In the latest version of spray-json there is now a sortedPrint method for this: https://github.com/spray/spray-json/pull/164