Alfred Morgan <[email protected]> added the comment:
@serhiy.storchaka while you are doing your overhaul will you please add support
for raw json values. I often find myself where I have a serialized object that
I want to include in an object response that I'm about to serialize anyway. The
implementation should be very simple. Here is my workaround code:
class RawJSON(str): pass
origEnc = json.encoder.encode_basestring_ascii
def rawEnc(obj):
if isinstance(obj, RawJSON):
return obj
return origEnc(obj)
json.encoder.encode_basestring_ascii = rawEnc
https://stackoverflow.com/a/48985560/289240
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue14573>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com