[issue41569] json.JSONEncoder.default should be called for dict keys as well

2021-12-29 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> json.dump() ignores its 'default' option when serializing 
dictionary keys

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41569] json.JSONEncoder.default should be called for dict keys as well

2020-08-17 Thread David Byrne

New submission from David Byrne :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com