[issue24518] json.dumps should accept key function for ``sort_keys``

Bob Ippolito report at bugs.python.org
Mon Jun 29 20:13:42 CEST 2015


Bob Ippolito added the comment:

On further investigation, simplejson has implemented this functionality under a different name since 2.5.0 (2012-03-29).

"""
If item_sort_key is a callable (not the default), then the output of dictionaries will be sorted with it. The callable will be used like this: sorted(dct.items(), key=item_sort_key). This option takes precedence over sort_keys.

Changed in version 2.5.0: item_sort_key is new in 2.5.0.
"""

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24518>
_______________________________________


More information about the Python-bugs-list mailing list