Added sort_keys kwarg to write_json