New submission from Pierre Hanser <han...@club-internet.fr>: The json module provides an encoder python -> json. The encoding may be specialized by the user, using the cls parameter of the dumps function.
But all simple types are always handled by the library encoder, the user encoder is only used as a last resort one, for unknown types. This is not described nor intuitive, and it prevents specifying a custom encoder for classes which inherit from simple type. in the provided example (thanks Raymond) a user defined boolean type, inheriting from int, is handled as int where you would prefer it to be handled as a json boolean through a custom encoder. problem seen on simplejson-2.0.9 or official python 2.6.1 ---------- components: Library (Lib) files: jsonCustomEncoder.py messages: 83962 nosy: phanser severity: normal status: open title: json custom encoder not fully functionnal type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file13393/jsonCustomEncoder.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5535> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com