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 phanser
Recipients phanser
Date 2009-03-22.08:03:37
SpamBayes Score 1.0571863e-06
Marked as misclassified No
Message-id <1237709020.89.0.211179227863.issue5535@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2009-03-22 08:03:40phansersetrecipients: + phanser
2009-03-22 08:03:40phansersetmessageid: <1237709020.89.0.211179227863.issue5535@psf.upfronthosting.co.za>
2009-03-22 08:03:38phanserlinkissue5535 messages
2009-03-22 08:03:38phansercreate