Problems of JSON output of rewritten serialization routines
Compared to the old serialization routines, the new ones do not
- format the resulting JSON string (tabs + newlines missing) so it is not a nicely readable
- sort the keys in the JSON string. This is inconvenient for use with (external) versioning systems (git, svn, etc) as JSON representations of pulses might change due to reordering between subsequent savings even if the pulse itself didn't change

Implement the above two features
diff --git a/qctoolkit/serialization.py b/qctoolkit/serialization.py
index 2e5675f4..b441cb28 100644
--- a/qctoolkit/serialization.py
+++ b/qctoolkit/serialization.py
@@ -679,7 +679,7 @@ class PulseStorage:
             if is_transaction_begin:
                 self._transaction_storage = dict()
 
-            encoder = JSONSerializableEncoder(self)
+            encoder = JSONSerializableEncoder(self, sort_keys=True, indent=4)
 
             serialization_data = serializable.get_serialization_data()
             serialized = encoder.encode(serialization_data)
diff --git a/tests/serialization_tests.py b/tests/serialization_tests.py
index e8b01091..1853318e 100644
--- a/tests/serialization_tests.py
+++ b/tests/serialization_tests.py
@@ -522,7 +522,7 @@ class PulseStorageTests(unittest.TestCase):
         self.assertNotIn('my_id_2', self.backend)
         self.assertIs(previous_inner, self.storage['my_id_1'])
 
-        enc = JSONSerializableEncoder(None)
+        enc = JSONSerializableEncoder(None, sort_keys=True, indent=4)
         expected = enc.encode(previous_inner.get_serialization_data())
         self.assertEqual(expected, self.backend['my_id_1'])
 
@@ -554,6 +554,24 @@ class PulseStorageTests(unittest.TestCase):
 
         self.assertFalse(self.storage.temporary_storage)
 
+    def test_beautified_json(self) -> None:
+        data = {'e': 89, 'b': 151, 'c': 123515, 'a': 123, 'h': 2415}
+        template = DummySerializable(data=data)
+        pulse_storage = PulseStorage(DummyStorageBackend())
+        pulse_storage['foo'] = template
+
+        expected = """{
+    \\"#type\\": \\"""" + DummySerializable.get_type_identifier() + """\\",
+    \\"data\\": {
+        \\"a\\": 123,
+        \\"b\\": 151,
+        \\"c\\": 123515,
+        \\"e\\": 89,
+        \\"h\\": 2415
+    }
+}"""
+        self.assertEqual(expected, pulse_storage._storage_backend['foo'])
+
 
 class JSONSerializableDecoderTests(unittest.TestCase):
     def test_filter_serializables(self):
['tests/serialization_tests.py', 'qctoolkit/serialization.py']