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 Marian Horban 2
Recipients Marian Horban 2
Date 2017-04-20.10:04:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492682646.2.0.186501711671.issue30114@psf.upfronthosting.co.za>
In-reply-to
Content
It is not possible to override 'true', 'false' values during encoding bool.
For example if I want to dump dict like:
    {"key": True}
and result must be not 
    {"key": true}
but let's say
    {"key": "TRUE"}
It is really hard to force json.dumps function to do it.

I understand that improving of json encoder performance causes this inflexible implementation.
Perfect solution for extending/overriding json module would be move nested functions
_iterencode_list
_iterencode_dict
_iterencode
into class JSONEncoder as static methods.
But it could make performance a bit worse.

So if we cannot afford it I would propose to move function _make_iterencode to JSONEncoder as a static method.
This change will not degrade performance.
But it will be possible to override this method in SPECIFIC user's Encoder.
History
Date User Action Args
2017-04-20 10:04:06Marian Horban 2setrecipients: + Marian Horban 2
2017-04-20 10:04:06Marian Horban 2setmessageid: <1492682646.2.0.186501711671.issue30114@psf.upfronthosting.co.za>
2017-04-20 10:04:06Marian Horban 2linkissue30114 messages
2017-04-20 10:04:05Marian Horban 2create