Sort keys during json.dumps.
Fix tests.