This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Daniel Ward, Ollie Ford, abarry, berker.peksag, r.david.murray, serhiy.storchaka, steven.daprano
Date 2017-03-05.06:23:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488695031.58.0.721926526929.issue27362@psf.upfronthosting.co.za>
In-reply-to
Content
This could fix other issues:

* issue16535 -- for Decimal.
* issue20774 -- for deque.
* issue24313 -- for NumPy numeric types.
* issue26263 -- for array.

Currently the blessed way of JSON encoder customization is to implement the default method in JSONEncoder subclass or pass the default argument to dump(). But that requires changing every JSON serialization call and handling all non-standard types in one function. I think it would be handly to pick the type-specific serialization function from: 1) per-encoder dispatch table, 2) global dispatch type (registry), 3) __json__ method. This can be done after the default function fails or be included in the default default method.

This will add JSON support of standard library types (e.g. collections other than list, tuple and dict, numbers other than int and float) and will help to implement task specific serialization of user classes.
History
Date User Action Args
2017-03-05 06:23:51serhiy.storchakasetrecipients: + serhiy.storchaka, steven.daprano, r.david.murray, berker.peksag, abarry, Daniel Ward, Ollie Ford
2017-03-05 06:23:51serhiy.storchakasetmessageid: <1488695031.58.0.721926526929.issue27362@psf.upfronthosting.co.za>
2017-03-05 06:23:51serhiy.storchakalinkissue27362 messages
2017-03-05 06:23:51serhiy.storchakacreate