Sorting before saving the object to a file like in approvals makes it much easier to diff two JSON documents that may not originally be in the same order.
So I threw together this quick little helper. It's far from perfect and won't suit all needs. But if all you're trying to do is sort and serialize an object it seems to be working well for now.
Happy Dictionary Reading!