Sort JSON keys when writing.

Make sure tox and pep8 are satisfied.