Message315297
| Author |
Zectbumo |
| Recipients |
Aaron.Staley, Zectbumo, eric.araujo, ezio.melotti, ned.deily, pitrou, rhettinger, serhiy.storchaka, vlcinsky |
| Date |
2018年04月14日.15:53:49 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1523721229.86.0.682650639539.issue14573@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
@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 |
|