From 2c5b840d3f8b9ff53208d3cdad103b1a72f1d150 2011-11-06 03:18:21 From: MinRK Date: 2011-11-06 03:18:21 Subject: [PATCH] sort keys when writing json notebooks --- diff --git a/IPython/nbformat/v2/nbjson.py b/IPython/nbformat/v2/nbjson.py index b86297d..e67bec3 100644 --- a/IPython/nbformat/v2/nbjson.py +++ b/IPython/nbformat/v2/nbjson.py @@ -48,6 +48,7 @@ class JSONWriter(NotebookWriter): def writes(self, nb, **kwargs): kwargs['cls'] = BytesEncoder kwargs['indent'] = 4 + kwargs['sort_keys'] = True return json.dumps(nb, **kwargs)