New submission from David Byrne <david.byrne...@gmail.com>:

Sub-classing and overriding json.JSONEncoder.default allows users to create 
custom serialisation for objects that can’t otherwise be serialized. However, 
this method is only called for dictionary values such that dictionary supported 
keys (i.e. hashable types) can not be fully utilized. Calling .default on keys 
as well as values allows users to to fully utilize json for all dict supported 
types. 

See 
https://stackoverflow.com/questions/63393059/json-dump-not-calling-default-or-cls
 for example

----------
components: Library (Lib)
messages: 375561
nosy: david.byrne222
priority: normal
severity: normal
status: open
title: json.JSONEncoder.default should be called for dict keys as well
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41569>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to