28
28
Compact encoding::
29
29
30
30
>>> import json
31
- >>> from collections import OrderedDict
32
- >>> mydict = OrderedDict([('4', 5), ('6', 7)])
31
+ >>> mydict = {'4': 5, '6': 7}
33
32
>>> json.dumps([1,2,3,mydict], separators=(',', ':'))
34
33
'[1,2,3,{"4":5,"6":7}]'
35
34
@@ -286,9 +285,8 @@ def load(fp, *, cls=None, object_hook=None, parse_float=None,
286
285
result of any object literal decoded with an ordered list of pairs. The
287
286
return value of ``object_pairs_hook`` will be used instead of the ``dict``.
288
287
This feature can be used to implement custom decoders that rely on the
289
- order that the key and value pairs are decoded (for example,
290
- collections.OrderedDict will remember the order of insertion). If
291
- ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.
288
+ order that the key and value pairs are decoded. If ``object_hook`` is also
289
+ defined, the ``object_pairs_hook`` takes priority.
292
290
293
291
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
294
292
kwarg; otherwise ``JSONDecoder`` is used.
@@ -314,9 +312,8 @@ def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None,
314
312
result of any object literal decoded with an ordered list of pairs. The
315
313
return value of ``object_pairs_hook`` will be used instead of the ``dict``.
316
314
This feature can be used to implement custom decoders that rely on the
317
- order that the key and value pairs are decoded (for example,
318
- collections.OrderedDict will remember the order of insertion). If
319
- ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.
315
+ order that the key and value pairs are decoded. If ``object_hook`` is also
316
+ defined, the ``object_pairs_hook`` takes priority.
320
317
321
318
``parse_float``, if specified, will be called with the string
322
319
of every JSON float to be decoded. By default this is equivalent to
0 commit comments